Fixed project structure for pycharm
@@ -1,30 +1,19 @@
|
||||
from datetime import date
|
||||
|
||||
from flask import Flask
|
||||
from flask import redirect, g
|
||||
from flask import render_template
|
||||
from flask import url_for
|
||||
from flask.ext.mail import Mail
|
||||
from flask.ext.security import Security, SQLAlchemyUserDatastore, \
|
||||
UserMixin, RoleMixin, login_required, roles_required
|
||||
from flask.ext.security import user_registered
|
||||
from flask_mail import Mail
|
||||
from flask_security import Security, SQLAlchemyUserDatastore, \
|
||||
login_required, roles_required, user_registered
|
||||
from flask_security.core import current_user
|
||||
from flask_security.forms import LoginForm
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask.ext.security.forms import LoginForm
|
||||
import os
|
||||
from config import config
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECURITY_PASSWORD_HASH'] = 'pbkdf2_sha512'
|
||||
app.config['SECURITY_REGISTERABLE'] = True
|
||||
app.config['SECURITY_CHANGEABLE'] = True
|
||||
app.config['SECURITY_RECOVERABLE'] = True
|
||||
app.config.from_envvar('config')
|
||||
app.config.from_object(__name__)
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
mail = Mail(app)
|
||||
|
||||
import rollerverbrauch.tools as tools
|
||||
|
||||
from rollerverbrauch.forms import \
|
||||
from .forms import \
|
||||
CreatePitstopForm, \
|
||||
EditVehicleForm, \
|
||||
DeleteVehicleForm, \
|
||||
@@ -32,15 +21,22 @@ from rollerverbrauch.forms import \
|
||||
DeleteAccountForm, \
|
||||
DeletePitStopForm, \
|
||||
EditPitstopForm
|
||||
from .tools import *
|
||||
|
||||
from rollerverbrauch.entities import \
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(config[os.getenv('FLASK_CONFIG') or 'default'])
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
mail = Mail(app)
|
||||
|
||||
from .entities import \
|
||||
User, \
|
||||
Role, \
|
||||
Pitstop, \
|
||||
Vehicle
|
||||
|
||||
from .filters import *
|
||||
#import rollerverbrauch.tools as tools
|
||||
# required to activate the filters
|
||||
import rollerverbrauch.filters
|
||||
|
||||
|
||||
user_datastore = SQLAlchemyUserDatastore(db, User, Role)
|
||||
@@ -1,5 +1,5 @@
|
||||
from rollerverbrauch import db
|
||||
from flask.ext.security import UserMixin, RoleMixin
|
||||
from app import db
|
||||
from flask_security import UserMixin, RoleMixin
|
||||
|
||||
roles_users = db.Table('roles_users',
|
||||
db.Column('user_id', db.Integer(), db.ForeignKey('user.id')),
|
||||
@@ -1,4 +1,4 @@
|
||||
from rollerverbrauch import app
|
||||
from app import app
|
||||
import hashlib
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ def edit_costs_check(form, field):
|
||||
if costs_check_required and field.data is not None and field.data <= 0:
|
||||
raise ValidationError('Costs must be above 0.01 €.')
|
||||
|
||||
|
||||
class SelectVehicleForm(Form):
|
||||
vehicle = SelectField('Vehicle', coerce=int)
|
||||
submit = SubmitField(label='Do it!')
|
||||
12
app/main.py
@@ -1,12 +0,0 @@
|
||||
import os
|
||||
from rollerverbrauch import app
|
||||
import logging
|
||||
|
||||
|
||||
def setup_logging():
|
||||
logging.basicConfig(format='%(asctime)s [%(levelname)s]: %(message)s', level=logging.INFO)
|
||||
|
||||
if __name__ == '__main__':
|
||||
DEBUG = 'DEBUG' in os.environ and os.environ['DEBUG'] != 'False'
|
||||
setup_logging()
|
||||
app.run(debug=DEBUG, host='0.0.0.0')
|
||||
@@ -1,5 +0,0 @@
|
||||
Flask
|
||||
Flask-SQLAlchemy
|
||||
Flask-Security
|
||||
Flask-WTF
|
||||
PyMySQL
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 980 B After Width: | Height: | Size: 980 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |