Lunching for groups.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

65 lines
2.0 KiB

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys
import logging
from flask import Flask
# ----------------------------------------------------------------------
# Config
# ----------------------------------------------------------------------
class Settings(object):
SQLALCHEMY_DATABASE_URI = 'sqlite://./luncho.db3'
DEBUG = True
log = logging.getLogger('luncho.server')
# ----------------------------------------------------------------------
# Load the config
# ----------------------------------------------------------------------
app = Flask(__name__)
app.config.from_object(Settings)
app.config.from_envvar('LUCNHO_CONFIG', True)
# ----------------------------------------------------------------------
# Database
# ----------------------------------------------------------------------
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy(app)
class User(db.Model):
username = db.Column(db.String, primary_key=True)
fullname = db.Column(db.String, nullable=False)
passhash = db.Column(db.String, nullable=False)
token = db.Column(db.String)
issued_date = db.Column(db.Date)
validated = db.Column(db.Boolean, default=False)
def __init__(self, username, fullname, passhash, token=None,
issued_date=None, validated=False):
self.username = username
self.fullname = fullname
self.passhash = passhash
self.token = token
self.issued_date = issued_date
self.validated = validated
# ----------------------------------------------------------------------
# Blueprints
# ----------------------------------------------------------------------
from blueprints.index import index
from blueprints.users import users
app.register_blueprint(index, url_prefix='/')
app.register_blueprint(users, url_prefix='/user/')
# ----------------------------------------------------------------------
# Main
# ----------------------------------------------------------------------
if __name__ == '__main__':
log.warning('Use manage.py to run the server.')
sys.exit(1)