Spaces:
Runtime error
Runtime error
File size: 958 Bytes
8397f09 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import os
import logging
from logging.handlers import RotatingFileHandler
from app import create_app
from config import config
# Get environment from environment variable
env = os.environ.get('FLASK_ENV', 'development')
app = create_app(config[env]) # Pass the config class, not an instance
# Configure logging
if not app.debug:
if not os.path.exists('logs'):
os.mkdir('logs')
file_handler = RotatingFileHandler(
'logs/app.log',
maxBytes=10240,
backupCount=10
)
file_handler.setFormatter(logging.Formatter(
'%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'
))
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)
app.logger.setLevel(logging.INFO)
app.logger.info('Legal Document Analysis startup')
if __name__ == "__main__":
app.run(
host=os.environ.get('HOST', '0.0.0.0'),
port=int(os.environ.get('PORT', 5000))
)
|