Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated requirements.txt, coded a little
- Loading branch information
1 parent
e24cd23
commit bd18f2c
Showing
6 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,39 @@ | ||
# use __all__ = ['models'] pattern | ||
#!usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import os | ||
import sys | ||
|
||
from flask import Flask, render_template, g, request | ||
from flask.ext.bootstrap import Bootstrap | ||
from flask.ext.mail import Mail, Message | ||
from flask.ext.moment import Moment | ||
from flask.ext.login import LoginManager, current_user, logout_user | ||
from flask_wtf.csrf import CsrfProtect | ||
|
||
# 将project目录加入sys.path | ||
project_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
if project_path not in sys.path: | ||
sys.path.insert(0, project_path) | ||
|
||
csrf = CsrfProtect() | ||
|
||
bootstrap = Bootstrap() | ||
moment = Moment() | ||
mail = Mail() | ||
|
||
|
||
def create_app(config_name): | ||
app = Flask(__name__) | ||
app.config.from_object(config[config_name]) | ||
config[config_name].init_app(app) | ||
|
||
bootstrap.init_app(app) | ||
mail.init_app(app) | ||
moment.init_app(app) | ||
csrf.init_app(app) | ||
|
||
register_db(app) | ||
register_login_manager(app) | ||
register_routes(app) | ||
register_uploadsets(app) | ||
register_error_handle(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
|
||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
class Config: | ||
SECRETE_KEY = os.urandom(32) | ||
MAIL_SUBJECT_PREFIX = '[CODINGPY]' | ||
MAIL_SENDER = 'CODINGPY Admin <songbingjin@126.com>' | ||
ADMIN = os.environ.get('CODINGPY_ADMIN') | ||
|
||
@staticmethod | ||
def init_app(app): | ||
pass | ||
|
||
|
||
class DevelopmentConfig(Config): | ||
DEBUG = True | ||
MAIL_SERVER = 'smtp.126.com' | ||
MAIL_PORT = 25 | ||
MAIL_USERNAME = os.environ.get('DEV_MAIL') | ||
MAIL_PASSWORD = os.environ.get('DEV_MAIL_PASSWORD') | ||
SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URI') \ | ||
or "postgresql://postgres@localhost/codingpy" | ||
|
||
|
||
class ProductionConfig(Config): | ||
SQLALCHEMY_DATABASE_URI = os.environ.get('PRO_DATABASE_URI') | ||
|
||
|
||
class TestingConfig(Config): | ||
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URI') | ||
|
||
|
||
config = { | ||
'development': DevelopmentConfig, | ||
'testing': TestingConfig, | ||
'production': ProductionConfig, | ||
'default': DevelopmentConfig | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from flask.ext.script import Manager | ||
from flask.ext.mail import Mail, Message | ||
from flask.ext.migrate import Migrate, MigrateCommand | ||
|
||
from codingpy import app, db | ||
|
||
manager = Manager(app) | ||
migrate = Migrate(app, db) | ||
|
||
manager.add_command('db', MigrateCommand) | ||
|
||
if __name__ == '__main__': | ||
manager.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
alembic==0.8.2 | ||
Babel==2.0 | ||
blinker==1.4 | ||
dominate==2.1.12 | ||
Flask==0.10.1 | ||
Flask-Admin==1.3.0 | ||
Flask-BabelEx==0.9.2 | ||
Flask-Bcrypt==0.6.2 | ||
Flask-Bootstrap==3.3.5.6 | ||
Flask-Cache==0.13.1 | ||
Flask-Login==0.3.0 | ||
Flask-Mail==0.9.1 | ||
Flask-Migrate==1.5.1 | ||
Flask-Moment==0.5.1 | ||
Flask-Script==2.0.5 | ||
Flask-SQLAlchemy==2.0 | ||
Flask-WTF==0.12 | ||
itsdangerous==0.24 | ||
Jinja2==2.8 | ||
Mako==1.0.2 | ||
MarkupSafe==0.23 | ||
psycopg2==2.6.1 | ||
python-bcrypt==0.3.1 | ||
python-editor==0.4 | ||
pytz==2015.4 | ||
qiniu==7.0.5 | ||
requests==2.7.0 | ||
speaklater==1.3 | ||
SQLAlchemy==1.0.8 | ||
Werkzeug==0.10.4 | ||
wheel==0.24.0 | ||
WTForms==2.0.2 |