mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Remove flask-script, move commands to click
click (http://click.pocoo.org/) is used by flask to run its cli args. In removing flask_script (it's unmaintained), we had to migrate all our commands to use click. This is a change for the better in my eyes - you don't need to define the command in several places, and it makes managing options a bit easier. View diff with whitespace turned off unless you're a masochist.
This commit is contained in:
@@ -1,38 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
##!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import os
|
||||
from flask_script import Manager, Server
|
||||
from flask_migrate import Migrate, MigrateCommand
|
||||
from app import (create_app, db, commands)
|
||||
|
||||
application = create_app()
|
||||
manager = Manager(application)
|
||||
port = int(os.environ.get('PORT', 6011))
|
||||
manager.add_command("runserver", Server(host='0.0.0.0', port=port))
|
||||
from flask import Flask
|
||||
|
||||
migrate = Migrate(application, db)
|
||||
manager.add_command('db', MigrateCommand)
|
||||
manager.add_command('create_provider_rate', commands.CreateProviderRateCommand)
|
||||
manager.add_command('purge_functional_test_data', commands.PurgeFunctionalTestDataCommand)
|
||||
manager.add_command('custom_db_script', commands.CustomDbScript)
|
||||
manager.add_command('populate_monthly_billing', commands.PopulateMonthlyBilling)
|
||||
manager.add_command('backfill_processing_time', commands.BackfillProcessingTime)
|
||||
manager.add_command('populate_service_email_reply_to', commands.PopulateServiceEmailReplyTo)
|
||||
manager.add_command('populate_service_sms_sender', commands.PopulateServiceSmsSender)
|
||||
manager.add_command('populate_service_letter_contact', commands.PopulateServiceLetterContact)
|
||||
manager.add_command('populate_service_and_service_history_free_sms_fragment_limit',
|
||||
commands.PopulateServiceAndServiceHistoryFreeSmsFragmentLimit)
|
||||
manager.add_command('populate_annual_billing', commands.PopulateAnnualBilling)
|
||||
manager.add_command('rerun_build_dvla_file', commands.ReRunBuildDvlaFileForJob)
|
||||
from app import create_app
|
||||
|
||||
app = Flask('app')
|
||||
|
||||
@manager.command
|
||||
def list_routes():
|
||||
"""List URLs of all application routes."""
|
||||
for rule in sorted(application.url_map.iter_rules(), key=lambda r: r.rule):
|
||||
print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
manager.run()
|
||||
create_app(app)
|
||||
|
||||
Reference in New Issue
Block a user