Forums

Creating the database

Hi there,

Doing the djangogirls tutorial and usually at this point it asks you to create the database within the bash console using the following:

python manage.py migrate

On previous occasions this has worked fine, when using sqlite3, however this is the first time i'm using postgresql and this time when I ran the above command I received the following:

ImportError: No module named 'allauth'

I've got everything working fine locally, django-allauth is recognised, so was just wondering if there is something different I need to do in terms of the configuration when using postgresql?

Thanks in adavnce

Ok so what I've realised is that I needed to import the module in the pythonanywhere virtualenv.

So I pip installed the following: django-allauth pyscopg2

Now when I tried to run the migrate command I get the following:

File "/home/LocalPython3/local-python-3/myvenv/lib/python3.5/site-packages/psycopg2/init.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) django.db.utils.OperationalError: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Any thoughts?

Make sure you have the postgres configs correct in your django settings.py. Double check you have the right port and host address vs what your database tab gives you.

Hey Conrad,

Thanks for the reply.

Does the postgres config in settings.py have to mirror the config given to me in the database tab? So basically the hostname and port no., from the database tab, need to be plugged in to settings.py, right?

Yes