1 - Why && Installation
1.1. Why??
Django is a Python framework to build Web-Applications. You can use it for small to large projects.
Here you can find some companies which are using django.
Reasons to use django:
- Community: It has 25K readers on Reddit and 1.8K contributors on github.
- Because of the community there are endless custom modules
- large variety of Authentication policies
- ORM´s for SQLLite, Postgresql, MySQL, MariaSQL, MongoDB, ...
- Uses Serializers
- on of the best documentations I ever read
- has Internationalization
- ...
1.2. Requirements
- an IDE like Pycharm or a Texteditor like VIM
- Python 3.5+ download here
- basic knowledge of Python3
1.3. Installation
1.3.1 Projectfolder
Create somewhere a folder, in my case "tut-django".
Open your shell. Go inside this folder, init git and create a requirements.txt
mkdir tut-django
cd tut-django
git init
touch requirements.txt
Install via pip "virtualenv", create a virtualenv and activated it. Why you should use virtualenv?
pip install virtualenv
virtualenv ENV
source ENV/bin/activate
Add the following requirements to the requirements.txt.
django
djangorestframework
markdown
And install it and start your first django project
pip install -r requirements.txt
django-admin startproject tutorial
My project is called "tutorial". Inside you can find a lot of files. Don´t panic. In the next part I will explain what the files and folders means.
Inside the folder tutorial/tutorial you can find a file settings.py. Add the following:
....
INSTALLED_APPS = [
....
'rest_framework',
]
.....
At the end we will try to run the service to check if everything is fine.
cd tutorial
python manage.py runserver
If you can see a line like this everything is fine.
....
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Try to enter http://127.0.0.1:8000/ . You will find a nice landingpage.
Congratulation! You made it through the first part.
Part 2 soon
Posted on Utopian.io - Rewarding Open Source Contributors