Browse Source

last code clean up of the night

current_wdka_release
crunk 3 years ago
parent
commit
8857f17f7f
  1. 12
      verse/app.py
  2. 1
      verse/deploydb.py
  3. 5
      verse/forms/themeform.py
  4. 2
      verse/start.py
  5. 1
      verse/usermodel.py

12
verse/app.py

@ -17,10 +17,10 @@ login_manager = LoginManager()
def create_app(): def create_app():
APP = Flask(__name__, static_folder="static") APP = Flask(__name__, static_folder="static")
APP.secret_key = 'secret-key' APP.secret_key = "secret-key"
APP.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///data/distribusiverse.db" APP.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///data/distribusiverse.db"
APP.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True APP.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
#APP.config['MAX_CONTENT_LENGTH'] = 150 * 1024 * 1024 APP.config["MAX_CONTENT_LENGTH"] = 150 * 1024 * 1024
login_manager.session_protection = "strong" login_manager.session_protection = "strong"
login_manager.login_view = "index" login_manager.login_view = "index"
@ -28,8 +28,8 @@ def create_app():
csrf = CSRFProtect() csrf = CSRFProtect()
APP.config['SECRET_KEY'] = os.urandom(24) APP.config["SECRET_KEY"] = os.urandom(24)
APP.config['UPLOAD_FOLDER'] = 'tmpupload' APP.config["UPLOAD_FOLDER"] = "tmpupload"
csrf.init_app(APP) csrf.init_app(APP)
login_manager.init_app(APP) login_manager.init_app(APP)

1
verse/deploydb.py

@ -6,6 +6,7 @@ def deploy():
# This model is required for flask_migrate to make the table # This model is required for flask_migrate to make the table
from usermodel import User # noqa: F401 from usermodel import User # noqa: F401
from distribusimodel import Distribusis # noqa: F401 from distribusimodel import Distribusis # noqa: F401
app = create_app() app = create_app()
app.app_context().push() app.app_context().push()
db.create_all() db.create_all()

5
verse/forms/themeform.py

@ -1,7 +1,5 @@
"""Form object declaration.""" """Form object declaration."""
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import validators
from wtforms import ( from wtforms import (
RadioField, RadioField,
SubmitField, SubmitField,
@ -10,12 +8,13 @@ from wtforms import (
class ThemeForm(FlaskForm): class ThemeForm(FlaskForm):
"""Publication upload form.""" """Publication upload form."""
theme = RadioField( theme = RadioField(
"Select your theme:", "Select your theme:",
choices=[ choices=[
("hacking", "Hacking"), ("hacking", "Hacking"),
("peachsunset", "Peach sunset"), ("peachsunset", "Peach sunset"),
("wdka", "WdkA") ("wdka", "WdkA"),
], ],
) )
save = SubmitField("Save") save = SubmitField("Save")

2
verse/start.py

@ -23,7 +23,6 @@ from flask_login import (
current_user, current_user,
) )
from flask_bcrypt import generate_password_hash
from flask_wtf.csrf import CSRFError from flask_wtf.csrf import CSRFError
from app import create_app, db, login_manager from app import create_app, db, login_manager
@ -31,7 +30,6 @@ from usermodel import User
from distribusimodel import Distribusis from distribusimodel import Distribusis
# Forms! # Forms!
from forms.registerform import RegisterForm
from forms.uploadform import UploadForm from forms.uploadform import UploadForm
from forms.distribusiform import DistribusiForm from forms.distribusiform import DistribusiForm
from forms.themeform import ThemeForm from forms.themeform import ThemeForm

1
verse/usermodel.py

@ -11,6 +11,5 @@ class User(UserMixin, db.Model):
email = db.Column(db.String(150), unique=True, nullable=False) email = db.Column(db.String(150), unique=True, nullable=False)
password = db.Column(db.String(300), nullable=False, unique=False) password = db.Column(db.String(300), nullable=False, unique=False)
def __repr__(self): def __repr__(self):
return "<User %r>" % self.email return "<User %r>" % self.email

Loading…
Cancel
Save