def main(argv): random.seed() config = 'camputer.config.DevelopmentConfig' help_message = 'temperatures_3hrs.py -c <config>\r\nconfig can be:\r\n camputer.config.DevelopmentConfig (default)\r\n camputer.config.TestingConfig\r\n camputer.config.ProductionConfig' try: opts, args = getopt.getopt(argv,"hc:",["config="]) except getopt.GetoptError: print(help_message) sys.exit(2) for opt, arg in opts: if opt == '-h': print(help_message) sys.exit() elif opt in ("-c", "--config"): config = arg app = create_app(config) create_readings('temperature',16,2) create_readings('outside',0,4) create_readings('darksky',0,4)
def main(argv): is_load = False config = 'camputer.config.DevelopmentConfig' help_message = 'create_db.py -l -c <config>\r\nconfig can be:\r\n camputer.config.DevelopmentConfig (default)\r\n camputer.config.TestingConfig\r\n camputer.config.ProductionConfig' try: opts, args = getopt.getopt(argv, "hlc:", ["config="]) except getopt.GetoptError: print(help_message) sys.exit(2) for opt, arg in opts: if opt == '-h': print(help_message) sys.exit() elif opt == '-l': is_load = True elif opt in ("-c", "--config"): config = arg app = create_app(config) db.create_all() if is_load: load_sample_data()
#!/home/neilb/camputer-server/venv/bin/python from camputer import create_app application = create_app('camputer.config.ProductionConfig')
def create_app(self): return create_app('camputer.config.TestingConfig')
import unittest from flask_sqlalchemy import SQLAlchemy from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from camputer import create_app, db app = create_app('camputer.config.DevelopmentConfig') migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) @manager.command def test(): """Runs the tests without code coverage""" tests = unittest.TestLoader().discover('tests', pattern='test*.py') result = unittest.TextTestRunner(verbosity=2).run(tests) if result.wasSuccessful(): return 0 return 1 if __name__ == '__main__': manager.run()
def create_app(self): return create_app('camputer.config.DevelopmentConfig')
def create_app(self): return create_app('camputer.config.ProductionConfig')