Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some improvements for Flask 1.0: flask.cli instead of Flask-Script, b…
…etter config search, dotenv etc.
- Loading branch information
Showing
26 changed files
with
179 additions
and
95 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 |
---|---|---|
|
@@ -29,6 +29,8 @@ dist/ | |
*.mo | ||
|
||
# mini_fiction stuff | ||
/.env | ||
/.flaskenv | ||
/local_settings.py | ||
/local/ | ||
/media/ | ||
|
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 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 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,2 @@ | ||
MINIFICTION_SETTINGS=mini_fiction.settings.Config | ||
FLASK_ENV=production |
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 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 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 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 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 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 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 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 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 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 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,15 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import click | ||
from pony import orm | ||
|
||
from mini_fiction.management.manager import manager | ||
from mini_fiction.management.manager import cli | ||
|
||
|
||
@manager.option('-s', '--silent', dest='silent', help='Don\'t print progress bar to console', action='store_true') | ||
def seed(silent=False): | ||
@cli.command() | ||
@click.option('-s', '--silent', 'silent', help='Don\'t print progress bar to console', is_flag=True) | ||
def seed(silent): | ||
from mini_fiction import fixtures | ||
orm.sql_debug(False) | ||
fixtures.seed(verbosity=1 if silent else 2, only_create=True) |
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 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,15 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
from flask import current_app | ||
from pony.orm import db_session | ||
|
||
from mini_fiction.management.manager import manager | ||
from mini_fiction.management.manager import cli | ||
|
||
|
||
@manager.command | ||
@cli.command() | ||
def shell(): | ||
import code | ||
import mini_fiction | ||
from mini_fiction import models | ||
with db_session: | ||
code.interact(local={'mini_fiction': mini_fiction, 'app': manager.app, 'm': models}) | ||
code.interact(local={ | ||
'mini_fiction': mini_fiction, | ||
'app': current_app._get_current_object(), | ||
'm': models, | ||
}) |
Oops, something went wrong.