Non existing path when setting up Flask to have separated configurations for each environment Non existing path when setting up Flask to have separated configurations for each environment flask flask

Non existing path when setting up Flask to have separated configurations for each environment


It took me a while but I finally found it:

  1. Flask doesn't like projects with __init__.py at root level, delete myapp/__init__.py. This is the one located at the root folder:

    myapp├── __init__.py     <--- DELETE...└── myapp    ├── __init__.py  <--- keep    └── myapp.py
  2. Use $ export FLASK_APP=myapp/myapp.py

  3. The environment variable specifying the configuration should be the absolut path to it: export APP_CONFIG_FILE="/home/user/myapp/config/development.py"

Now everything works \o/

$ flask run* Serving Flask app "myapp.myapp"* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)$ flask shellPython 3.5.2+ (default, Sep 22 2016, 12:18:14) [GCC 6.2.0 20160927] on linuxApp: myappInstance: /home/user/myapp/instance>>>