Sample blog web application using Python Django + Postgres.
Sample blog web application using Python Django + Postgres.
CREATE DATABASE blogdb;
CREATE USER blogdbuser WITH PASSWORD 'YOUR_PASSWORD';
ALTER ROLE blogdbuser SET client_encoding TO 'utf8';
ALTER ROLE blogdbuser SET default_transaction_isolation TO 'read committed';
ALTER ROLE blogdbuser SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE blogdb TO blogdbuser;
Remember the values you've entered above. It'll be helpful in upcoming steps.
settings.py
and change the values of these fields:DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'DB_NAME',
'USER': 'DB_USER',
'PASSWORD': 'DB_PASSWORD',
'HOST': 'localhost',
'PORT': '',
}
}
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
Now after succesfully executing above commands, visit below URL's to test this app.
Function | Description | URL |
---|---|---|
Admin | Django Admin Panel | localhost:8000/admin |
Blog App | Blog App UI | localhost:8000/blog |
API | REST API | localhost:8000/api |