manage.py requires a secret key
Closed this issue · 5 comments
Running ./manage.py update
yields the error "You need to specify a SECRET_KEY" because it's including potsfyi.py. This is not true: no key is needed to simply update the DB, so manage.py shouldn't give this error.
I think the root problem is that I need to move the Track
and Album
models out of potsfyi.py into a separate "models.py" file or similar. Only problem is they inherit from db.Model
and db
comes from this line:
db = SQLAlchemy(app)
So all the models seemingly have to be in the same file where the application object is instantiated, or have access to it. Not sure yet what the Flasky solution to this is.
I made the engine in the model and imported in the app:
https://github.com/tippenein/fact_scrape/blob/master/fact_scraper/fact_scraper.py#L33
This might be relevant.
Brilliant. Can you do the same thing for Pots and submit a pull request?
I split out the models and it's cleaner in my opinion. However, I can't test it at the moment because of npm issues. I pushed it to a temporary branch -> the diff
Just a progress update for now.
As far as the manage.py issue goes, I think we need some other way of doing this. I pushed the split up models to my master repo, but there must be a way to tell if the app is being accessed by manage.py or potsfyi itself.