Harsh Upadhyay
adding backend to spaces with initial commit.
8397f09
raw
history blame contribute delete
958 Bytes
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))
)