A few years ago I built an app using Flask 1.0.1 and some packages in their current versions at the time, as shown in the requirement.txt file:
alembic==1.0.2
certifi==2018.11.29
dominate==2.3.5
enum34==1.1.6
Flask==1.0.2
Flask-Admin==1.5.3
Flask-Bootstrap==3.3.7.1
Flask-Login==0.4.1
Flask-Migrate==2.3.1
Flask-SQLAlchemy==2.3.2
Flask-WTF==0.14.2
gunicorn==19.9.0
itsdangerous==1.1.0
Jinja2==2.10
Mako==1.0.7
MarkupSafe==1.1.0
numpy==1.15.4
python-dateutil==2.8.0
six==1.12.0
SQLAlchemy==1.2.17
visitor==0.1.3
Werkzeug==0.14.1
WTForms==2.1
psycopg2==2.7.6.1
pandas==1.1.0
plotly==4.8.2
At the time I deployed it to heroku and was fully functional although only with demonstration purposes (then, heroku started charging and it was deleted). Recently I tried to run it locally creating a python environment using the requirements.txt file but it failed to install some of the packages. I tried installing the packages manually and even though the app did not raise any error, the server simply did not start. I read somewhere that there were some changes in recent versions of flask that changed the way apps are run, but I'm not sure about it.
Since I developed the app for an organization (it's not mine anymore), I cannot give you the full repository, but I'll try to describe its structure:
├── DMMexico.py
├── Procfile
├── README.md
├── app
│ ├── __init__.py
│ ├── errors.py
│ ├── forms.py
│ ├── modelosdm2.py
│ ├── models.py
│ ├── routes.py
│ ├── static
│ │ ├── css
│ │ │ └── style.css
│ │ ├── favicon.ico
│ │ └── img
│ │ ├── logo_conacyt_md.png
│ │ ├── logo_izt_md.png
│ │ ├── logo_lab_md.png
│ │ └── logo_uami_md.png
│ └── templates
│ ├── 404.html
│ ├── 500.html
│ ├── about.html
│ ├── agregar_hb.html
│ ├── base.html
│ ├── colonia.html
│ ├── consultar_curp.html
│ ├── consultar_sujeto.html
│ ├── index.html
│ ├── login.html
│ ├── medicion_hb.html
│ ├── perfil.html
│ ├── register.html
│ ├── result.html
│ ├── result_hb.html
│ └── territorial.html
├── app.db
├── config.py
├── logs
│ └── errors.log
├── migrations
└── requirements.txt
The main file is DMMexico.py, which only contains: from app import app
The app folder contains the init.py file, which contains:
from flask import Flask
from config import Config
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_admin import Admin
from flask_bootstrap import Bootstrap
import logging
from logging.handlers import RotatingFileHandler
import os
app = Flask(__name__)
app.config.from_object(Config)
db = SQLAlchemy(app)
migrate = Migrate(app, db)
login = LoginManager(app)
login.login_view = 'login'
bootstrap = Bootstrap(app)
admin = Admin(app)
from app import routes, models, errors
if not app.debug:
if not os.path.exists('logs'):
os.mkdir('logs')
file_handler = RotatingFileHandler('logs/errors.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('Sitio deteccion')
When I try to run the app using: python DMMexico.py, the server simply don't start, although there is no error. Only something like the following is printed in the terminal:
[2024-01-16 21:36:15,063] INFO in __init__: Sitio deteccion
which is created in the last section of the init.py file (if not app.debug:).
I'm not a developer. I built the app following some tutorials everywhere just for fun and to learn something, so that's why I have no clue about how to make it work. I have no idea about how to debug it since not even the server is launched and therefore, I cannot see any error in the browser. Any help would be really appreciated.