Skip to main content

Making a simple blog in Django

So we will be starting making a simple blog in django but before this you have to read basic documentation of django(2.1).
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
  1. Create a new django project by typing django-admin startproject myblog
  2. Go into that folder and create an app by typing python3 manage.py startapp blog 
  3. Type python3 manage.py runserver and see if django is working fine. If you're good to go proceed to next step.
  4. Copy all the code you wrote while making polls app to their respective folders and files.
Now start making changes
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

Popular posts from this blog

Solve http://xss-game.appspot.com/ Without Actually Solving It

First install web extension EditThisCookie from  http://www.editthiscookie.com/ Then open http://r00tz-web-intro.appspot.com/rootz And solve all challenges in it. They are all damn easy. when you have solved all levels in it and paste it's cookies in  http://xss-game.appspot.com/ and refresh the home page. And you will see that you have completed all the levels.

Want a P5 bug or escalate it to P3 or P4

Hello Everyone, Many months back when i was testing on hackerone and i came across Jenkins instance. So first and foremost i did directory bruteforce and found interesting thing  on Jenkins instance i reported it got closed as informational as it was a VDP (was noob back there) I came across some more programs on jenkins instance and same error also appeared there . So i searched for more instances and it was working on all of then. What was the issue? Let's say target.com is jenkins instance so if we hit http://target.com/assets/ It throws stack error giving us instance information REPORTED I reported this to jenkins https://www.jenkins.io/security/ and after some days i recieved a  mail   I was so glad that i was going to get CVE in my pocket. BUT unfortunately So i guess i wasn't getting any CVE So if anyone want any information about instance or plugins feel free to use above method if not fixed Here's Jira issue https://issues.jenki...

Can wrong code can lead to RCE?

Yes I am talking about Python input vulnerability which exists in only Python 2 version. Even code written in python 3 and  executed in python2 can be exploited. So I wrote test code in python3 and i executed in python 2 to check it Above is the following code Now it's execution It's performing some action unlike raw_input which considers everything as string. Now what if i type vulnerable code inside   And we can import any library also. Comment below to make it a reverse shell.