Django Blog Project – Fully Fixed Step■by■Step Guide
This PDF contains a clean, runnable implementation with all errors fixed. Follow steps in order.
Step 0: Virtual Environment
● python -m venv env
● env\Scripts\activate
● pip install django
Step 1: Create Project & App
● django-admin startproject blogproject
● cd blogproject
● python [Link] startapp blog
Step 2: Register App ([Link])
● Add 'blog' to INSTALLED_APPS
Step 3: Static Files Configuration ([Link])
● STATIC_URL = '/static/'
● STATICFILES_DIRS = [ BASE_DIR / 'static' ]
Step 4: Models (blog/[Link])
● Category(name)
● Post(title, content, category(FK), created_at)
Step 5: Migrations
● python [Link] makemigrations
● python [Link] migrate
Step 6: Admin Registration (blog/[Link])
● Register Post and Category models
Step 7: Superuser
● python [Link] createsuperuser
Step 8: Templates Structure
● blog/templates/blog/
● [Link], [Link], [Link], post_form.html, confirm_delete.html, [Link], [Link]
Step 9: Base Template (Bootstrap fixed)
● Use Bootstrap 5 CDN (single-line link)
● Load static and include blog/[Link]
Step 10: Forms (blog/[Link])
● PostForm(ModelForm) with correct indentation
Step 11: Views (blog/[Link])
● home, post_detail
● create_post, edit_post, delete_post (login_required)
Step 12: URLs
● blog/[Link]: CRUD routes
● blogproject/[Link]: include blog, login, logout, signup
Step 13: Auth Settings ([Link])
● LOGIN_URL = 'login'
● LOGIN_REDIRECT_URL = 'home'
● LOGOUT_REDIRECT_URL = 'login'
Step 14: Run Server
● python [Link] runserver
● Open [Link]
Notes & Tips
• Ensure Bootstrap CDN is not broken by line breaks.
• Always include {% csrf_token %} in POST forms.
• Use instance=post while editing to avoid duplicate records.
• Configure static files to load CSS correctly.