-
-
Notifications
You must be signed in to change notification settings - Fork 14
Dev postgres #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev postgres #93
Conversation
commented out init_db and auth uncommented line 52 recommented lines 51-52 test app test script uri uri test test test combined test test 1 test 2
…nto dev_postgres
|
Is there any special significance to the env var name Whether or not it is a special env var matters for reasons I'll discuss once we're 100% certain that there is no special significance. If there is however special significance to it then disregard that. |
|
env var name DATABASE_URL doesn't hold any significance. In local machine, the env variable can be anything. However, to clarify, the config var for postgres URI for heroku will always be DATABASE_URL. The reason why they may match is to maintain consistency , but you can change it to your convenience. |
|
OK I see what's happening, Heroku auto-populates an env variable called The reason the special significance matters is because we have a system already for the environment variables prefixed Very boring stuff in the above paragraph. So why's that all matter? The reason is because I was taking the I think your solution to it is fine for now, although in the future we may want to consider consolidating everything a bit since right now the config can have values in it that seem contradictory, e.g. Also, I should have clarified that part of the requirements for the issue would be to clarify any steps like adding add-ons etc. but I figured it out. (if you think I'm bad at Heroku for not figuring out that first step immediately, the CRWA will also struggle with it...) Later we will have to add the thing about which add-ons to attach as part of our deployment documentation. I have your code "working" in the sense that the database is created on Heroku, but right now the database is blank for me. Are you experiencing the same thing there? If so, how do you suppose we initiate the database? One idea I have is to create a function called # contents of flagging_site/app.py
def create_app( ... ) -> Flask:
# ...
from .data.database import database_is_empty
if database_is_empty(db):
from .data.database import init_db
init_db()(We don't want to re-init the database each time the app fires up because due to how Heroku works, it ends up running the (That said, if possible and feasible, I would slightly prefer a solution that initiates the database as part of deployment and not as part of firing up the app instance in |
|
Ok sure. I will take a look into automating the init-db so CRWA don't need to go to heroku cli. I will look into saving the password into heroku config vars so that they don't need to remember the password nor exporting the password into heroku config vars. |
|
To clarify, we just need a process to set up and populate the database's tables at all using Also, that method of running Were you able to get the database populated? For me following your directions a database existed, but it was blank (no tables whatsoever) because There are no issues related to any passwords that need additional work in this issue. The |
|
I need to check again about populating the database in the most recent version of the code. I would also add to documentation about what I have done as well once I check. |
|
Never mind on the last part of this request, I found out a pretty decent system for getting the database up and running! |
For others to look at and add upon.