Forgot password?
Don't already have an account? Create an account.
By creating an Ordinary Coders account, you agree to Ordinary Coders' Terms and Condtions.
If you already have an account, login instead.
Create an account and receive 300 points to unlock projects, templates, and more.
June 4, 2020, 6:10 p.m.
Django · 2 min read
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 postgres; GRANT ALL PRIVILEGES ON DATABASE postgres TO postgres;
\\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 ...
Subscribe to stay current on our latest articles and promos
Post a Comment Join the community
April 25, 2020, 2:43 p.m.
Jan. 6, 2021
Oct. 16, 2020
Oct. 13, 2020
Oct. 6, 2020
Sept. 21, 2020