toddbirchard/flasklogin-tutorial

please provide sample .env file to configure environment variables.

aspiringguru opened this issue · 2 comments

I'm not familiar with this structure of flask app, between the missing .env file and the complexity of the flask app structure, I'm struggling to get this running.

I'm sure there's a couple of simple configuration items. sample environment variable settings would help. Several of the environment variables mentioned are not in common use.

I can see start.sh launches wsgi.py
from application import create_app

my current problem is configuring a database to connect to. Going back to a simpler examples in the series to master this. A little more detail in the tutorial would be helpful. Otherwise great content.

I just realize you must understand the concept in V. Configuring your Flask App. @toddbirchard gave an overview of the Configuration Variables.

Based on your current problem I think the solution lies on the Flask-SQLAlchemy section SQLALCHEMY_DATABASE_URI where you can follow SQLAlchemy specific documentation Engine Configuration based on your DBMS. For an easiest SQLLite example, include in your .env file :

SQLALCHEMY_DATABASE_URI = "sqlite:///foo.db"

I didn't try yet, but I think an candidate sample to .env file following the tutorial and config.py would be:

FLASK_ENV = "production"
SECRET_KEY = "YOURSECRETKEY"
LESS_BIN = "/path/to/less/compiler/"
ASSETS_DEBUG = False
LESS_RUN_IN_DEBUG = False
COMPRESSOR_DEBUG = False
SQLALCHEMY_DATABASE_URI = "sqlite:///foo.db"

Despite that, I understand your point and agree with you that would be easier to understand this piece of information if a sample of .env was provided.

The tutorial is really amazing and gave me a full perspective over Flask.

I recently decided to add .env.example files to each tutorial repo, and stumbled across this issue purely by chance. I hope things are a bit clearer now - there's surely always more we can do!

Thanks for stepping in @rdeiana!