diff --git a/hodor/__init__.py b/hodor/__init__.py index 9b9b1bab85cc3db24429afcc1dc95fb66f6bb618..cdcc372fb7e9a918c2b910f77a18163cc51f1955 100644 --- a/hodor/__init__.py +++ b/hodor/__init__.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # app/__init__.py import time -import copy +from termcolor import colored +import sys from flask_api import FlaskAPI from flask_sqlalchemy import SQLAlchemy # local import @@ -24,10 +25,13 @@ db.init_app(application) # Delay the application launch to get the user attention if running in testing mode if config_name != 'production': for x in range(0, 5): - print("You are not running the server in production mode.\ - App will run in {} seconds".format(5-x)) + sys.stdout.write(colored("\rYou are not running the server in production mode. " + + "App will run in {} seconds..".format(5-x), 'red')) + sys.stdout.flush() time.sleep(1) + print(colored("\n\nRunning app in {} mode..".format(config_name), 'yellow')) + # This disables the HTML API renderer for flask_api when called through browsers. if config_name == 'production': application.config['DEFAULT_RENDERERS'] = [ diff --git a/hodor/api/__init__.py b/hodor/api/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/hodor/api/user.py b/hodor/api/user.py deleted file mode 100644 index 2075c091de01301a18c7a2fd146fb09701f65317..0000000000000000000000000000000000000000 --- a/hodor/api/user.py +++ /dev/null @@ -1,12 +0,0 @@ -from hodor.app import api -from flask_restplus import Resource - -ns = api.namespace('/users', description='Operations related to blog posts') - -@ns.route('/users') -class listusers(Resource): - def get(self): - return {'user': 'noob'} - - -api.add_resource(listusers, '/users') \ No newline at end of file diff --git a/hodor/app.py b/hodor/app.py deleted file mode 100644 index 0f402ea0a18e68be106eacf6eb98d570df3f8a88..0000000000000000000000000000000000000000 --- a/hodor/app.py +++ /dev/null @@ -1,21 +0,0 @@ -from flask import Flask, request -from flask_restplus import Resource, Api -from api.user import ns as user_namespace - -app = Flask(__name__) -api = Api(app) - -todos = {} - -@api.route('/<string:todo_id>') -class TodoSimple(Resource): - def get(self, todo_id): - return {todo_id: todos[todo_id]} - - def put(self, todo_id): - todos[todo_id] = request.form['data'] - return {todo_id: todos[todo_id]} - -api.add_namespace(user_namespace) -if __name__ == '__main__': - app.run(debug=True) \ No newline at end of file