-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Update Django Flex Example to CloudSQL v2 #616
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
Conversation
| # Locally, you can use the CloudSQL proxy to proxy a localhost connection | ||
| # to the instance | ||
| if os.getenv('APPENGINE_FLEXIBLE'): | ||
| DATABASES['default']['HOST'] = '/cloudsql/<your-cloudsql-connection-string>' |
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.
Can't you have to separate database configs local and live and tell django to switch between them?
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.
If by different database configs you mean not have them both on default, you could, but then all your code and management commands have to specify the database, which I don't think is what you want for local vs production, because all the code would probably just point to some settings flag and it's a lot of code that accomplishes nothing. I think the feature is more for cases where in production there's multiple databases. If by different database configs you mean just totally separate dict objects that we pick here, it's just a readability preference. Since the configs are the same except for a single line, I thought this was easiest, you don't have to type in the password in two places, etc.
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.
Gotcha, then this is fine.
|
@dpebot squash merge on travis green |
|
Okay! I'll merge when all statuses are green. |
No description provided.