In this tutorial, we will see how to install Django and to set up a first Django project.
Let's consider that you have already installed python and pip, and have activated a virtual environment (if not, please see my virtualenv tutorial) in which you want to start playing with django.
First things first, let's install django and check the installed version:
pip install django python -c "import django; print(django.get_version())"
Now, we will follow the official django tutorial
mkdir djangoProj_1 cd djangoProj_1 django-admin.py startproject mysite ls -alh mysiteAs a result of these commands, django has initialized the project "mysite", which means that it has created a folder name "mysite" and put a bunch of python files in it. For python, mysite is a package, and it contains a few modules.
Django comes with a built-in server, to test your implementations:
python my_site/manage.py runserver firefox http://127.0.0.1:8000/You should see a django powered webpage saying 'it worked !'.
0 comments :
Post a Comment