Image for post
Image for post

Step 1. Setup Python: Go to home page python (remember install pip, i think version im using auto install pip so i dont need 😲)

Step 2. Go to home page of Django , and you can create project right now 😉

$ django-admin startproject project_name_here

you can create project everywhere, it dont same PHP (have to create in htdocs).

Okay, to run server, use cmd(remember cd into your project):

$ python manage.py runserver

Now, open broswer and type: http://127.0.0.1:8000/

it will same this:

Image for post
Image for post

you can also change port and IP address, example:

$ python manage.py runserver 8080$ python manage.py runserver 69.96.69.0:8000

Tip: you can edit url and use it dont need port, example:

$ python manage.py runserver 0.0.0.0:80

You can see folder structure of project:

mysite/
manage.py
mysite/
__init__.py
settings.py
urls.py
wsgi.py
  • Mysite/ folder you can see it is a package, app of project. This package same name of project, you can edit name if you want.
  • manage.py: a CLI help you interact with code Django
  • settings.py: all settings of this project
  • urls.py: Define urls of project.
  • wsgi.py: Use to deploy project on server.
  • __init__.py: f***, this file is empty 😝purpose of file make this folder become Python package.

I think everything is okay, we can develop project follow we like 😄

  • View admin view on url: /admin
  • create superuser and database:
$ python manage.py migrate
$ python manage.py createsuperuser
  • You can create app (app # project) use cmd:
$ python manage.py startapp app_name_you_want

Tip: Recommend for you video playlist about Django, hope it useful for you:

https://www.youtube.com/watch?v=qgGIqRFvFFk&list=PL6gx4Cwl9DGBlmzzFcLgDhKTTfNLfX1IK

OKAY. See you next part ✌️ Sr if my english is not good 😞

Written by

Be Curious!| ☕️+✍🏼=❤️ | buihuycuong.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store