-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
212 additions
and
78 deletions.
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.pyo | ||
venv | ||
-1 | ||
mana.egg-info |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
5 changes: 1 addition & 4 deletions
5
examples/GoodIdea/app/__init__.py → examples/init_cfg_project/app/__init__.py
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,20 +1,17 @@ | ||
# coding: utf-8 | ||
""" | ||
~~~~~~~ | ||
~~~~~~~~ | ||
""" | ||
|
||
from flask import Flask | ||
from config import config | ||
|
||
|
||
app = Flask(__name__) | ||
|
||
|
||
app.config.from_object(config['default']) | ||
|
||
|
||
from . import views, models, forms | ||
app.register_blueprint('book') | ||
app.register_blueprint('test', url_prefix='/test') |
File renamed without changes.
File renamed without changes.
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,47 @@ | ||
# coding: utf-8 | ||
""" | ||
config.py | ||
~~~~~~~~~ | ||
配置文件 | ||
""" | ||
|
||
import os | ||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
class Config: | ||
"""基本配置类""" | ||
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string' | ||
|
||
@staticmethod | ||
def init_app(app): | ||
pass | ||
|
||
|
||
class DevelopmentConfig(Config): | ||
"""开发环境配置类""" | ||
DEBUG = True | ||
|
||
|
||
class TestingConfig(Config): | ||
"""测试环境配置类""" | ||
TESTING = True | ||
WTF_CSRF_ENABLED = False | ||
|
||
|
||
class ProductionConfig(Config): | ||
"""生产环境配置类""" | ||
|
||
@classmethod | ||
def init_app(cls, app): | ||
Config.init_app(app) | ||
|
||
|
||
config = { | ||
'development': DevelopmentConfig, | ||
'testing': TestingConfig, | ||
'production': ProductionConfig, | ||
|
||
'default': DevelopmentConfig | ||
} |
File renamed without changes.
File renamed without changes.
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,15 @@ | ||
# coding: utf-8 | ||
""" | ||
~~~~~~~ | ||
""" | ||
|
||
from flask import Flask | ||
|
||
|
||
app = Flask(__name__) | ||
app.config["SECRET_KEY"] = "I love mana!" # you can change it :) | ||
|
||
|
||
from . import views, forms |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,23 @@ | ||
# coding: utf-8 | ||
""" | ||
~~~~~~~ | ||
""" | ||
|
||
from flask import Flask | ||
from flask.ext.sqlalchemy import SQLAlchemy | ||
from config import config | ||
|
||
|
||
app = Flask(__name__) | ||
|
||
|
||
app.config.from_object(config['default']) | ||
|
||
|
||
db = SQLAlchemy(app) | ||
|
||
|
||
from . import views, models, forms | ||
app.register_blueprint('share', url_prefix='/share') |
Binary file not shown.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Binary file not shown.
File renamed without changes.
Binary file not shown.
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
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,15 @@ | ||
# coding: utf-8 | ||
""" | ||
~~~~~~~ | ||
""" | ||
|
||
from flask import Flask | ||
|
||
|
||
app = Flask(__name__) | ||
app.config["SECRET_KEY"] = "I love mana!" # you can change it :) | ||
|
||
|
||
from . import views, forms |
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
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,47 @@ | ||
# coding: utf-8 | ||
|
||
import sys | ||
from flask.ext.script import Manager, Shell | ||
from flask.ext.migrate import Migrate, MigrateCommand | ||
from flask.ext.admin import Admin | ||
from flask.ext.admin.contrib.sqla import ModelView | ||
from app import app, db | ||
|
||
|
||
# 编码设置 | ||
reload(sys) | ||
sys.setdefaultencoding('utf-8') | ||
|
||
|
||
manager = Manager(app) | ||
migrate = Migrate(app, db) | ||
admin = Admin(app, name="") | ||
|
||
|
||
def make_shell_context(): | ||
"""自动加载环境""" | ||
return dict( | ||
app = app, | ||
db = db | ||
) | ||
|
||
|
||
manager.add_command("shell", Shell(make_context=make_shell_context)) | ||
manager.add_command('db', MigrateCommand) | ||
|
||
|
||
# 后台数据库管理界面 | ||
# admin.add_view(ModelView([models], db.session)) | ||
|
||
|
||
@manager.command | ||
def test(): | ||
"""运行测试""" | ||
import unittest | ||
tests = unittest.TestLoader().discover('test') | ||
unittest.TextTestRunner(verbosity=2).run(tests) | ||
|
||
|
||
if __name__ == '__main__': | ||
app.debug = True | ||
manager.run() |
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
Oops, something went wrong.