Skip to content
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

config.env database_url not working #181

Closed
tangyiming opened this issue Jan 28, 2019 · 3 comments
Closed

config.env database_url not working #181

tangyiming opened this issue Jan 28, 2019 · 3 comments

Comments

@tangyiming
Copy link

tangyiming commented Jan 28, 2019

i run a postgresql container in docker,
and add this in config.env:
DATABASE_URL=postgresql://postgres:docker@localhost:5432/postgres
but every time i run:
python manage.py setup_dev
it will creates data-dev.sqlite

ps:the db name and password is correct,i can use the command to connect:
psql -h localhost -U postgres -d postgres

@Euphorbium
Copy link

Euphorbium commented Jan 29, 2019

@tangyiming I haven't tested this, but have you tried setting SQLALCHEMY_DATABASE_URI instead?

@abhisuri97
Copy link
Contributor

@tangyiming the reason it does that is that you have the app in development mode. ChangeFLASK_CONFIG=production to get the ability to connect to a db. If you want to connect to a Db in dev mode then look at lines:

SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or \

Basically setDEV_DATABASE_URL=yoururlhere in config.env.

@tangyiming
Copy link
Author

@abhisuri97 thanks,it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants