Now that you have installed
Tech C**P enough, let's create the project by issuing the below command (project name:
Suppose our project name is
cd into the folder saturn and issue
Now the overall project looks like:
OK let's run our project and see what's in there (you should be in first
If you have a server listening on port 8000, give your port in front of runserver command as below:
There are some warnings (ignore them at the moment), at the end it is said that project is up and running on port 8000. You can see the output in the next post.
#python #django #runserver #startproject #django_part2
Django
successfully you need to start a project. Django
has a command for project administration called django-admin
, by using it you will be able to create a bare-bone project which includes database configuration, Django-specific options and application-specific settings.Tech C**P enough, let's create the project by issuing the below command (project name:
saturn
):$ django-admin startproject saturn
Suppose our project name is
saturn
you can name it everything you like.cd into the folder saturn and issue
ls
, to see list of files created by django-admin
:$ ls
manage.py saturn
NOTE:
do not call your project name django
or test
or anything that is somehow related to keywords, otherwise there will be conflict between your project and django.NOTE:
the project could live every where inside your server, it is not mandatory to put the code in /var/www/
as old PHP does that. It has the risk of exposing your project code to the wild west (Internet). :)Now the overall project looks like:
saturn/
manage.py
saturn/
__init__.py
settings.py
urls.py
wsgi.py
OK let's run our project and see what's in there (you should be in first
saturn
folder):$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
October 27, 2017 - 16:17:10
Django version 1.11.6, using settings 'saturn.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
If you have a server listening on port 8000, give your port in front of runserver command as below:
$ python manage.py runserver 8085
runserver
is a minimal developement-specific server written purely in python
. It reloads itself on code change. In some cases like adding a file does not trigger server reload so you have to restart it manually.There are some warnings (ignore them at the moment), at the end it is said that project is up and running on port 8000. You can see the output in the next post.
NOTE:
some future parts of the project could be in video podcast, it totally depends on your feedbacks and my time.#python #django #runserver #startproject #django_part2