Compare commits

..

No commits in common. "844c56c26c91efd8763c07e4b2db5c1d75d8451b" and "ab74ca205ab399d364814af46d2ba92fef33ef76" have entirely different histories.

4 changed files with 9 additions and 59 deletions

View File

@ -1,8 +1,2 @@
# tptimer # tptimer
a social network for speedcubers a social network to 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,21 +1,9 @@
import os import os
from dotenv import load_dotenv
__ALREADY_IMPORTED = False
if not __ALREADY_IMPORTED:
load_dotenv()
__ALREADY_IMPORTED = True
class Config(object): 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") SECRET_KEY=os.getenv("secret_key")
class DevelopmentConfig(Config): class DevelopmentConfig(Config):
DEBUG=True 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_DATABASE_URI = os.getenv("sql_uri")
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False

View File

@ -4,7 +4,7 @@ from wtforms import Form
from wtforms import StringField from wtforms import StringField
from wtforms import PasswordField from wtforms import PasswordField
from wtforms import validators from wtforms import validators
from wtforms import EmailField from wtforms.fields.html5 import EmailField
import requests import requests
import re import re
@ -26,24 +26,24 @@ class LoginForm(Form):
validators.DataRequired("Ingrese un nombre de usuario o #WCA-ID"), validators.DataRequired("Ingrese un nombre de usuario o #WCA-ID"),
validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido") validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido")
]) ])
password = PasswordField("Contraseña *", password = PasswordField(u"Contraseña *",
[ [
validators.DataRequired("Ingrese su contraseña") validators.required(u"Ingrese su contraseña")
]) ])
class SignupForm(Form): class SignupForm(Form):
username = StringField("Nombre de usuario *", username = StringField(u"Nombre de usuario *",
[ [
validators.DataRequired("Este campo es requerido"), validators.DataRequired("Este campo es requerido"),
validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido") validators.length(min=0,max=25,message="Ingrese un nombre de usuario valido")
]) ])
wcaId = StringField("#WCA-ID",[ wcaId = StringField(u"#WCA-ID",[
validateWCAID validateWCAID
]) ])
email = EmailField("Correo electronico *",[ email = EmailField(u"Correo electronico *",[
validators.DataRequired("Este campo es requerido"), validators.DataRequired("Este campo es requerido"),
validators.Email("Introduce una direccion de email valida") validators.Email("Introduce una direccion de email valida")
]) ])
password = PasswordField("Contraseña *",[ password = PasswordField(u"Contraseña *",[
validators.DataRequired("Este campo es requerido") validators.DataRequired("Este campo es requerido")
]) ])

View File

@ -1,32 +0,0 @@
[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"