-
Notifications
You must be signed in to change notification settings - Fork 447
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
Added postgre to database_uri #515
Conversation
Hi @isabelcosta or @ramitsawhney27. When you have time, can you please check this pull request? Thanks. 😉 |
@mtreacy002 Hi :) I am new to the mentorship-backend so take my advice with a grain of salt. In my projects, I handle multiple db options as follows:
This allows the user / contributor to input any database they want to use via a environment variable. And in case they don't provide any env var, the db connects to the default sqlite database. |
That's sounds ideal, @vkWeb, but should we also apply it here in Mentorship_System backend code, so, change the database reference in LocalConfig and TestingConfig of the config.py to use your line of code instead and change .env to include the DATABASE_URI of our preference. This way, no need to have separate db type commented out/uncomment every time user wants to use their favourite local db. |
@mtreacy002 I'm glad you liked the idea 😄. I think we should simply change the Also, shouldn't we simply allow DB_URI as env var instead of building one using all the db credentials? The contributor can simple provide the DB_URI in |
@vkWeb, I think the reason why the maintainers of mentorship-system put DB_URI in BaseConfig as it is now is to make it easier to control which remote db to be used as the primary db for Development, Staging and Production. It's pretty sensible to limit contributors option to only in the Local and Testing config. The only way us as contributors could choose to switch to our db preference is then to set FLAS_ENVIRONMENT_CONFIG to 'local'. |
This is also then allow contributors who don't want to use their own local server to use which ever primary db already set in the Development branch's server/s (atm in Heroku, before w elasticbeanstalk). These contributors don't need to provide any credentials if they want to use just the remote server/db provided by mentorship-backend. ...mmm.. I'm pretty sure they both (heroku and elasticbeanstalk servers) using postgre. Or maybe not...😂 do you know what our remote db is, @vkWeb? |
@mtreacy002 actually, I was saying that currently we are using a function
See, here's what I propose: we put that
API is hosted on heroku, so maybe heroku postgres 😛. I don't know, it's just a guess. |
Yep, sounds good to me... We'll wait and see what @isabelcosta think, I suppose. Maybe once she's not too busy with proposals selection. 😉 |
@isabelcosta needs your input here |
@@ -100,6 +100,8 @@ class LocalConfig(BaseConfig): | |||
# Using a local sqlite database | |||
SQLALCHEMY_DATABASE_URI = "sqlite:///local_data.db" | |||
|
|||
# Using a local postgre database | |||
# SQLALCHEMY_DATABASE_URI = "postgresql:///local_data" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the way to go. I think we should use environment variables for this.
@epicadk, @devkapilbansal and @vj-codes , I'll close this issue as this is a very old issue and the postgres db_uri is covered within the more recent issue (pr #1029) |
Description
Include a summary of the change and relevant motivation/context. List any dependencies that are required for this change.
Fixes #514
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
Running python run.py works as usual
Checklist:
Code/Quality Assurance Only