def setUp(self): """Setup test app""" self.app = create_app('tests.config') self.db = DbConnect(self.app.config) test_type_filename = 'server/tests/test_data_files/Test/Test_New_Logger_Type_Positive.csv' test_temp_filename = 'server/tests/test_data_files/Test/temp_files/DUMMYID_2000_pgsql.txt' with self.app.test_client() as client: with client.session_transaction() as sess: sess['logged_in'] = True response = client.post('/upload', data={ 'loggerTypeFile': (open(test_type_filename, 'rb'), 'Test_New_Logger_Type_Positive.csv') }, follow_redirects=True) response = client.post('/upload', data={ 'loggerTempFile': (open(test_temp_filename, 'rb'), 'DUMMYID_2000_pgsql.txt') }, follow_redirects=True) self.record_type = { "microsite_id" : "DUMMYID", "site" : "DUMMYSITE", "biomimic_type" : "Dummybiomimictype", "country" : "Dummycountry", "state_province" : "Dummystate", "location" : "Dummylocation", "field_lat" : "36.621933330000", "field_lon" : "-121.905316700000", "zone" : "DummyZone", "sub_zone" : "DummySubZone", "wave_exp" : "DummyWave"}
def setUp(self): """Define test variables and initialize.""" self.app = create_app(config_name="testing") self.client = self.app.test_client() self.users = { 'name': 'James Bond', 'email': '*****@*****.**', 'password': '******' }
def setUp(self): """Define the test variables and initialize the application.""" self.app = create_app(config_name="testing") self.client = self.app.test_client() self.questions = { 'ask': 'What is the difference between django and flask', 'language': 'python', 'date_posted': '7th May 2017' }
import os from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from app.views import db, create_app from app.models.users import User from app.models.countries import Country from app.models.posts import Post from app.models.comments import Comment app = create_app(config_name=os.getenv('APP_SETTINGS')) migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) if __name__ == '__main__': manager.run()
from app import views app = views.create_app() app.run(debug=app.debug)
"""This script runs the Flask application in development environment""" import os from app.views import create_app #pylint: disable=invalid-name port = int(os.environ.get('PORT', 5000)) app = create_app('app.config') app.run(host='0.0.0.0', port=port)
def setUp(self): """Setup test app""" self.app = create_app('app.config')
def setUp(self): """Setup test app""" self.app = create_app('tests.config') self.db = DbConnect(self.app.config)
def setUp(self): """Setup test app""" self.app = create_app('tests.config')
#!/usr/bin/env python # -*- coding: utf-8 -*i from flask import Flask, render_template, url_for, request, redirect, json, jsonify from flask_restful import Resource, Api, reqparse from app import settings, views from app.views import create_app, MakeShorterUrl app = create_app() api = Api(app) @app.route('/', defaults={'path': ''}) @app.route('/<path:path>') def index(path): return render_template('index.html') # urlとパスの紐付け api.add_resource(MakeShorterUrl, '/make') if __name__ == '__main__': print('main') app.run()
def setUp(self): """Setup test app""" self.app = create_app("tests.config") self.db = DbConnect(self.app.config)
def main(): setup_logging() deploy_db() app = create_app() print(app.url_map) # some debug info app.run(host=SERVER_ADDRESS, port=SERVER_PORT)
import os from flask_migrate import Migrate from app.views import create_app from shared import db app = create_app(os.getenv('APP_SETTINGS')) migrate = Migrate(app, db) if __name__ == '__main__': app.run()