Compare commits

...

2 Commits

Author SHA1 Message Date
kirbylife 844c56c26c add the instructions to run the server again 2023-07-14 00:19:51 -06:00
kirbylife f713a1de34 it's alivegit add . 2023-07-14 00:17:02 -06:00
4 changed files with 59 additions and 9 deletions

View File

@ -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`

View File

@ -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

View File

@ -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")
])
])

32
pyproject.toml 100644
View File

@ -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"