Exemple #1
0
from flask import Flask
from flask import request
from flask import jsonify
from flask import url_for
from flask import redirect
import json
from sqlalchemy import text
import requests
import pandas as pd

app = Flask(__name__)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config[
    'SQLALCHEMY_DATABASE_URI'] = 'sqlite:////Users/Sanjay/Documents/THIRD_YEAR_STUFF/SEMESTER_6/CLOUD_COMPUTING/test7.db'
#app.config['SQLALCHEMY_DATABASE_URI'] 	= 'sqlite:////home/ubuntu/CC_Assignment1/test.db'
db.init_app(app)


def isnumeric(string):
    try:
        num = int(string)
        return True
    except:
        return False


def check_sha1(string):
    if (len(string) != 40):
        return False
    for i in string:
        if (not (i == 'a' or i == 'b' or i == 'c' or i == 'd' or i == 'e'
from flask_migrate import Migrate
from flask_script import Manager

import settings

from sqlalch import db


app = Flask(__name__)
app.config.from_object(settings)

# allow cross-origin
CORS(app)

# flask-sqlalchemy
db.init_app(app)

# flask-migrate
migrate = Migrate(app, db)
manager = Manager(app)

# installed applications
for installed_app in settings.INSTALLED_APPS:
    mod = import_module(installed_app)
    try:
        url_prefix = mod.URL_PREFIX
    except AttributeError:
        app.register_blueprint(mod.bp)
    else:
        app.register_blueprint(mod.bp,
                               url_prefix='/{}'.format(url_prefix))