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:
you can also change port and IP address, example:
$ python manage.py runserver 8080$ python manage.py runserver 22.214.171.124: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/ 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:
OKAY. See you next part ✌️ Sr if my english is not good 😞