Created
May 14, 2015 15:10
-
-
Save cescoferraro/177d297af36d4e8059d0 to your computer and use it in GitHub Desktop.
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
if __name__ == '__main__': | |
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
result = sock.connect_ex(('127.0.0.1', 8080)) | |
if result == 0: | |
from flask.ext.migrate import Migrate, MigrateCommand | |
from app import db | |
migrate = Migrate(app, db) | |
from flask.ext.script import Manager | |
manager = Manager(app) | |
from scripts import Hello | |
manager.add_command('hello', Hello()) | |
from scripts import _make_contextt | |
from flask.ext.script import Shell | |
manager.add_command("shell", Shell(make_context=_make_contextt)) | |
manager.add_command('db', MigrateCommand) | |
manager.run() | |
else: | |
socketio.run(app, port=8080) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment