I am trying to deploy a project with digital ocean. I followed the instructions found at https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 Some of the important ones: I ran:
postgres=# CREATE DATABASE jobzumoDB;
CREATE DATABASE
then:
postgres=# CREATE USER admin WITH PASSWORD '123';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE jobzumoDB TO admin;
GRANT
set the following in settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'jobzumoDB',
'USER':'admin',
'PASSWORD':'123',
'HOST':'localhost',
'PORT':'',
}
then tried to run:
~/jobzumo/manage.py makemigrations
and got:
File "/home/justin/jobzumo/env/lib/python3.6/site-packages/psycopg2/__init__.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL: database "jobzumoDB" does not exist
Two things:
ALLOWED_HOSTS = ['jobzumo.com', '142.93.184.125']
I have not yet connect jobzumo.com to digital ocean, but the IP address was copied from my droplet.
Also, I ran: pip install django gunicorn psycopg2
(from digitial ocean)
but a tutorial on youtube said it was very important to now
install psycopg2-binary
instead, however, I did not do this as the video was veering far from digital ocean's tutorial.
Thanks for any help, after starting to understand django I didn't think deploying would be this much of a headscratcher.
sudo -u postgres psql -d jobzumoDB -U admin -W 123
psql: FATAL: Peer authentication failed for user "admin"
makemigrations
worked without a problem. Thank you, you've been tremendously helpful. If I wanted to learn more do I just need to read into postgres db? These are all commands I am unfamiliar with.