Forgot password?
Don't already have an account? Create an account.
By creating an Ordinary Coders account, you agree to Ordinary Coders' Terms and Conditions.
If you already have an account, login instead.
While SQLite is great for getting a basic Django project up and running, it has some limitations when it comes to concurrency and user management. For example, only one process can make changes to the database at any given moment, and having multiple users with different permissions is impossible. When SQLite is not enough, check out how to quickly get set up with PostgreSQL.
sudo apt update sudo apt install postgresql postgresql-contrib
psql -U postgres # after logged in as postgres CREATE USER username WITH PASSWORD 'jw8s0F4';
CREATE DATABASE exampledb; GRANT ALL PRIVILEGES ON DATABASE "exampledb" TO username;
\q
psql -U username
\c exampledb
pip install psycopg2-binary
# make sure to pip install psycopg2-binary #in settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', #some guides include the psycog2 part in the name 'NAME': config('DB_NAME'), #includes python decouple 'USER': config('DB_USER'), 'PASSWORD': config('DB_PASSWORD'), 'HOST':'localhost', 'PORT': '5432', } }
python3 manage.py makemigrations python manage.py migrate
If you can successfully migrate your database, then setup is complete. If unable to migrate, ensure all database configurations are correct and no typos exist.
Django Powered Blog for Affiliate Marketing
A Django powered blog and product showcase for affiliate marketing from Building a Django Web App course. Pre-built Django …
Follow us @ordinarycoders
Post a Comment Join the community
@ordinarycoders
April 25, 2020, 2:43 p.m.
April 14, 2021, 10:03 a.m.
ordinarycoders_bot
March 29, 2021, 7:30 p.m.
Jaysha
March 6, 2021, 2:47 p.m.
James
March 3, 2021, 6:04 p.m.
Jan. 5, 2021, 4:39 p.m.