Compare commits
2 Commits
ab74ca205a
...
844c56c26c
Author | SHA1 | Date |
---|---|---|
kirbylife | 844c56c26c | |
kirbylife | f713a1de34 |
|
@ -1,2 +1,8 @@
|
|||
# tptimer
|
||||
a social network to speedcubers
|
||||
a social network for speedcubers
|
||||
|
||||
|
||||
## Instuctions to run the server in dev mode
|
||||
1. run `poetry install`
|
||||
1. create a .env file that contains "secret_key" and "sql_uri" env vars
|
||||
1. execute `poetry run python app.py`
|
||||
|
|
12
config.py
12
config.py
|
@ -1,9 +1,21 @@
|
|||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
__ALREADY_IMPORTED = False
|
||||
|
||||
if not __ALREADY_IMPORTED:
|
||||
load_dotenv()
|
||||
__ALREADY_IMPORTED = True
|
||||
|
||||
|
||||
class Config(object):
|
||||
if not os.getenv("secret_key"):
|
||||
raise Exception("Must be setted the 'secret_key' env var")
|
||||
SECRET_KEY=os.getenv("secret_key")
|
||||
|
||||
class DevelopmentConfig(Config):
|
||||
DEBUG=True
|
||||
if not os.getenv("sql_uri"):
|
||||
raise Exception("Must be setted the 'sql_url' env var")
|
||||
SQLALCHEMY_DATABASE_URI = os.getenv("sql_uri")
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
|
14
forms.py
14
forms.py
|
@ -4,7 +4,7 @@ from wtforms import Form
|
|||
from wtforms import StringField
|
||||
from wtforms import PasswordField
|
||||
from wtforms import validators
|
||||
from wtforms.fields.html5 import EmailField
|
||||
from wtforms import EmailField
|
||||
|
||||
import requests
|
||||
import re
|
||||
|
@ -26,24 +26,24 @@ class LoginForm(Form):
|
|||
validators.DataRequired("Ingrese un nombre de usuario o #WCA-ID"),
|
||||
validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido")
|
||||
])
|
||||
password = PasswordField(u"Contraseña *",
|
||||
password = PasswordField("Contraseña *",
|
||||
[
|
||||
validators.required(u"Ingrese su contraseña")
|
||||
validators.DataRequired("Ingrese su contraseña")
|
||||
])
|
||||
|
||||
class SignupForm(Form):
|
||||
username = StringField(u"Nombre de usuario *",
|
||||
username = StringField("Nombre de usuario *",
|
||||
[
|
||||
validators.DataRequired("Este campo es requerido"),
|
||||
validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido")
|
||||
])
|
||||
wcaId = StringField(u"#WCA-ID",[
|
||||
wcaId = StringField("#WCA-ID",[
|
||||
validateWCAID
|
||||
])
|
||||
email = EmailField(u"Correo electronico *",[
|
||||
email = EmailField("Correo electronico *",[
|
||||
validators.DataRequired("Este campo es requerido"),
|
||||
validators.Email("Introduce una direccion de email valida")
|
||||
])
|
||||
password = PasswordField(u"Contraseña *",[
|
||||
password = PasswordField("Contraseña *",[
|
||||
validators.DataRequired("Este campo es requerido")
|
||||
])
|
|
@ -0,0 +1,32 @@
|
|||
[tool.poetry]
|
||||
name = "tptimer"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["A social network to speedcubers"]
|
||||
license = "Apache 2.0"
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
Flask = "^2.3.2"
|
||||
Flask-WTF = "^1.1.1"
|
||||
pyTwistyScrambler = "^1.6"
|
||||
WTForms = "^3.0.1"
|
||||
Flask-SQLAlchemy = "^3.0.5"
|
||||
Werkzeug = "^2.3.6"
|
||||
wtforms-html5 = "^0.6.1"
|
||||
requests = "^2.31.0"
|
||||
email-validator = "^2.0.0.post2"
|
||||
python-dotenv = "^1.0.0"
|
||||
pysqlite3 = "^0.5.1"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
ipython = "^8.14.0"
|
||||
pytest = "^7.4.0"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
server = "app:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
Loading…
Reference in New Issue