Skip to content

Instantly share code, notes, and snippets.

@ratulSharker
Last active May 6, 2018 06:02
Show Gist options
  • Save ratulSharker/41500aa56c3701657de0bfcfe9bc114b to your computer and use it in GitHub Desktop.
Save ratulSharker/41500aa56c3701657de0bfcfe9bc114b to your computer and use it in GitHub Desktop.
This gist provide basic command line guideline for setting up Django rest framework
#
# Here it is assumed that you are in osx/linux/windows environment
# and you have already installed python3
#
#
# Creating a virtual environment
#
# osx/linux
python3 -m venv ~/YOUR_DESIRED_PROJECT_DIRECTORY_PATH
# windows
python -m venv %USERPROFILE%\YOUR_DESIRED_PROJECT_DIRECTORY_PATH
#
# Activating created virtual environment
#
# osx/linux
source ~/YOUR_DESIRED_PROJECT_DIRECTORY_PATH/bin/activate
# windows
%USERPROFILE%\YOUR_DESIRED_PROJECT_DIRECTORY_PATH\Scripts\activate.bat
#
# Deactivating current virtual environment
#
# osx/linux
deactivate
# windows
%USERPROFILE%\YOUR_DESIRED_PROJECT_DIRECTORY_PATH\Scripts\deactivate.bat
#
# Installing Django
#
# osx/linux/windows
pip install django
#
# Installing Django-REST Framework
#
# osx/linux/windows
pip install djangorestframework
#
# Creating new project with Django
#
# osx/linux/windows
django-admin.py startproject YOUR_DESIRED_PROJECT_NAME
#
# Creating new app inside your project
#
# osx/linux/windows
python manage.py startapp YOUR_DESIRED_APP_NAME
#
# Making a migrating
#
# osx/linux/windows
python manage.py makemigrations YOUR_APP_NAME
#
# Applying Migration
#
# osx/linux/windows
python manage.py migrate
#
# Launch Django Interactive Shell
#
# osx/linux/windows
python manage.py shell
#
# Running Django Development server
#
# osx/linux/windows
python manage.py runserver
#
# Running Django Development server, so that it can be accessible from other machine (listening on all interface)
#
# osx/linux/windows
python manage.py runserver 0.0.0.0:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment