Sample blog web application using Python Django + Postgres.
- Run these below commands in PSQL Shell:
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.
- Go to
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': '',
}
}
- Install Requirements:
pip install -r requirements.txt
- Setup Initial Database structure:
python manage.py makemigrations
python manage.py migrate
- Create superuser
python manage.py createsuperuser
- Run App
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 |
- User Authentication
- Add/Edit/Delete Posts
- Add/Edit/Delete Categories (Using Django Admin)
- Listing Posts
- Filter by Category
- Filter by Tags
- Tests
- REST API for posts