Search code examples
pythondjangopostgresqldockercookiecutter

Problems with database setup on cookiecutter-django


I'm trying to use cookiecutter-django according to the instructions on github. First of all i created a postgres database by means of docker with:

docker run -p ::5432 \
--name db \
-e POSTGRESQL_DB=hartl \
-e POSTGRESQL_USER=docker \
-e POSTGRESQL_PASS=docker \
kamui/postgresql

and it worked fine from terminal.

After this i used the DATABASE_URL as an environment variable, according to the instructions:

export DATABASE_URL=postgres://docker:docker@dbserver_ip:5432/hartl

as my variable is postgres://docker:docker@dbserver_ip:5432/hartl.

BUT when i try:

python myapp/manage.py migrate

i'm having this error:

django.core.exceptions.ImproperlyConfigured: Error importing module dj_database_url: "No module named dj_database_url"

what can be wrong?


Solution

  • Just a problem with pip. After installing all dependencies, everything is working fine.