gl0deanr / create-flask-app Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi!
I'm 'husudosu' from Reddit r/flask. After cloning your project I tried to start the migration procedure but config.py file missing by default. I'd suggest using creating config.py by default on the package and maybe use a class-based Config.
I imagine something like this:
# This is config.py
# In my opinion better practice to use .env files instead requiring users/developers to edit .py files before starting out with a project.
# you could load environment file based on FLASK_DEBUG environment variable. If FLASK_DEBUG not present on the system, it means we running on production config.
# dotenv is a 3rd party lib https://pypi.org/project/python-dotenv/
from dotenv import load_dotenv
if os.environ.get("FLASK_DEBUG") == 1:
load_dotenv("development.env")
else:
load_dotenv("production.env")
class Config:
SQLALCHEMY_DATABASE_URI = os.environ.get("SQLALCHEMY_DATABASE_URI")
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.environ.get("SECRET_KEY")
# Other options...
# createflaskapp.__init__.py
# You import Config class and
app.config.from_object(Config)
# And you don't need to set SECRET_KEY, DATABASE URI or other options on your __init__.py.
Note: This implementation only a draft, so this is not the full code. I'm using pattern like this on my production projects.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.