2

I've followed the Djangogirls tutorial and usually the tutorial calls for you to create a database on pythonanywhere. This usually works without a hitch when using sqlite3 however this time I'm using postgresql and I got the below error when I ran the migrate command in the console:

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

What does this mean exactly?

using python 3.5.1 django 1.9.8 postgresql 9.4

Thanks

Ok after reading around some more, this is my problem in a nutshell.

I have postgresql running locally. I then deployed the wbapp onto pythonanywhere. Whilst there I tried to create the database by running migrate which resulted in the above error.

Since then i realised that I had to setup postgresql to run on pythonanywhere. I followed the instructions and did that, but what I don't understand is do I now have to create the database from scratch? And if that is the case what happens to all my tables etc. from my local database?

John
  • 21
  • 4

2 Answers2

4

To clarify, you should not be trying to connect to your local postgres. Instead, you should setup postgres on pythonanywhere, and make sure that your django settings.py is pointing the database address and port to the pythonanywhere database. Which is not local to the console/webapp server that you are running your code on. Instead, go to the pythonanywhere database tab and look at the address/port that is given to you.

conrad
  • 1,783
  • 14
  • 28
3

According to their help page you need to upgrade to a paid account to be able to use postgres.

rafalmp
  • 3,988
  • 3
  • 28
  • 34