Making a simple blog in Django
And i am using python3.5.2 , django2.1, Ubuntu 16.04.
First go to https://docs.djangoproject.com/en/2.1/intro/ and create their app.
If you haven't created that app please don't proceed further.
We will be going to make change in their app only to create a blog app.
Follow these below steps to create a simple blog.
Basic Setup
- Create a new django project by typing django-admin startproject myblog
- Go into that folder and create an app by typing python3 manage.py startapp blog
- Type python3 manage.py runserver and see if django is working fine. If you're good to go proceed to next step.
- Copy all the code you wrote while making polls app to their respective folders and files.
First go to myblog/myblog/settings.py
and change polls.apps.PollsConfig to blog.apps.BlogConfig.
Now go to myblog/myblog/urls.py and change urlspatterns .
Just change your project name from mysite to myblog and change your appname from polls to blog.
We need to remove myblog/blog/templates/blog/results.html
Changes are to be made on
myblog/blog/templates/blog/index.html
myblog/blog/templates/blog/detail.html
myblog/blog/urls.py
myblog/blog/admin.py
myblog/blog/models.py
myblog/blog/views.py
so First we go to models.py and change it
views.py
urls.py
admin.py
index.html
detail.html
After this type following commands
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py createsuperuser
You can also look at my whole code here
https://github.com/Vikas92155/Simple_Blog
Try relating each and every code to polls app you will understand more.
Please do give me a feedback !!
let me know if you are having a issue making this blog
Comments
Post a Comment