def run(self): """runs the application :returns: @todo """ db.create_db('%s.db' % self.scraper) if self.scraper == 'gumtree': parser = gumtree.GumTree(self.keyword) elif self.scraper == 'seek': parser = seek.Seek(self.keyword) parser.parse_listing_pages(job_parser, self.on_page_done, keyword=self.keyword, scraper=self.scraper)
from flask_script import Manager from flask_sqlalchemy import SQLAlchemy from os import environ as env from app.admin import create_admin from app.app import create_app from app.db import create_db from app.jwt import create_jwt from app.mail import create_mail from app.models import Busket, Category, Good, User, Order PORT = int(env.get("PORT", 5000)) app: Flask = create_app() CORS(app) db: SQLAlchemy = create_db(app) jwt: JWTManager = create_jwt(app) manager: Manager = Manager(app) migrate: Migrate = Migrate(app, db) manager.add_command('db', MigrateCommand) admin: Admin = create_admin(app) mail: Mail = create_mail(app) @manager.command def run(): system('python manage.py db upgrade') app.run(debug=True, host="0.0.0.0", port=PORT) if __name__ == '__main__':
#!/usr/bin/python # Imports from flask import Flask, render_template, redirect, url_for, request, session import os, sys from app import db app = Flask(__name__) HOME_PAGE = 'index.html' # Home page @app.route('/') @app.route('/home') def home(): return render_template(HOME_PAGE) # Login page. Until we have a login page, go to the home page instead. @app.route('/login', methods=['GET', 'POST']) def login(): return render_template("updatename.html") # Start the application if __name__ == "__main__": db.create_db() app.run(debug=True)
# -*- coding: utf-8 -*- import asyncio from app.db import create_db if __name__ == '__main__': print('Creating db') loop = asyncio.get_event_loop() create_db(loop) print('Done!')