How to start a Django Rest Framework Project in github
Let's assume that your project will be call citiesprj, and your project folder ~/projects, your first app will be called cities and your env will be called cities too.
- Create your account in github if you don't have one already
- Create a new repository(use in .gitignore python template)
- Install git in your desktop compueter(it will be different depending on your OS)
- cd to the folder where you have your projects
- git clone https://github.com/<your user in github>/citiesprj
- cd to ~/projects/citiesprj
- Use Virtual Environment Wrapper to handle your virtual environments.
- mkvirtual env cities
- mkdir requirements
- mkdir requiremtns/python
- vi requirements/python/base.txt
pip install Django==1.9.5
pip install djangorestframework==3.3.3
pip install django-rest-swagger==0.3.6
- pip install -r requirements/python/base.txt
- cd citiesprj/apps
django-admin.py startapp cities
- cd ../../
- vi citiesprj/settings.py
- add 'citiesprj.apps.cities' to your INSTALLED_APPS tuple
- ready to start adding Django stuff now
We use this structure base on
Two Scoops of Django: Best Practices for Django 1.8
and our experience in different jobs. We also include a bash file cli-test.sh in the root directory of the project with this info:
#!/bin/bash
./manage.py test -- $1
Once you have created your skeleton you are ready to your first commit to github
I use PyCharm so I add .idea/ to my .gitignore file
git add .
git commit -m "first commit -> project skeleton"
git push origin master
Good luck!!!