Django REST #1 - Why && Installation

in #utopian-io6 years ago (edited)

header

Django Rest Dokumentation

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

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

Sort:  

Your contribution cannot be approved because it is not as informative as other contributions. See the Utopian Rules. Contributions need to be informative and descriptive in order to help readers and developers understand them.

Hi, alongside being too short, your contribution was also rejected because

  • Contributions must be unique. Users must first check if the same or very similar contribution has been submitted before. Comparing your tutorial to this tutorial, I think you should be able to see why your tutorial can't be accepted.

I also had to change the linked repository to the correct one (if you create a GitHub repository with additional material (like code samples), make sure to choose the repository of the project your tutorial is about and not your own repository), so I recommend you read the rules before contributing again in the future.

You can contact us on Discord.
[utopian-moderator]

Congratulations @cytex124! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @cytex124! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Boost Your Post. Send 0.100 STEEM or SBD and your post url on memo and we will resteem your post on 5000+ followers. check our account to see the follower count.

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.029
BTC 56679.48
ETH 2377.65
USDT 1.00
SBD 2.26