Answer the question
In order to leave comments, you need to log in
How to give the server access to the project database?
In theory, for the server to work, it remains to complete the last step from the instruction
https://www.8host.com/blog/obsluzhivanie-prilozhen...
Access rights (last section). The guide describes an example deployment with a SQLite database, and I'm using PostgreSQL. the SQLite database is located in the root folder of the project, but PostgreSQL is not there. Where to look for it?
How to run
chmod 664 ~/myproject/db.sqlite3
and others for postgre?
Thanks in advance for your reply
Answer the question
In order to leave comments, you need to log in
If you did everything only according to this instruction, then you need to redo it a bit.
sudo -u postgres psql
postgres# CREATE DATABASE myprojectDB ;
postgres# CREATE USER myprojectDBuser WITH PASSWORD ' password ';
postgres# ALTER ROLE myprojectDBuser SET client_encoding TO 'utf8';
postgres# ALTER ROLE myprojectDBuser SET default_transaction_isolation TO 'read committed';
postgres# ALTER ROLE myprojectDBuser SET timezone TO 'UTC';
postgres# GRANT ALL PRIVILEGES ON DATABASE myprojectDB TO myprojectDBuser;
postgres# \q
Find the settings.py file in the django folder and edit the database section:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': ' myprojectDB ',
'USER': ' myprojectuser ' ,
'PASSWORD': ' password ',
'HOST': 'localhost',
'PORT': '',
}
}
Save file and then run again:
~/myproject/manage.py makemigrations
~/myproject/manage.py migrate
Should earn.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question