Skip to content

Instantly share code, notes, and snippets.

@jspw
Created March 25, 2020 11:16
Show Gist options
  • Save jspw/391a7e78d3ae2caf967d1cb8aba7ee33 to your computer and use it in GitHub Desktop.
Save jspw/391a7e78d3ae2caf967d1cb8aba7ee33 to your computer and use it in GitHub Desktop.
How To Start Web Development With Django 3.0.4

Django 3 !

Creating a virtual setup for Django

About Virtual Environment :

  • Check virtual environment list : conda info --envs
  • Viewing a list of the packages in an environment : conda list -n envirnment_name or
    • Activate the envirment : conda activate env_name
    • pip list

Create new project

  • django-admin startproject project_name

  • cd project_name

Create application (you can create as many applications under a project)

  • python manage.py startapp app_name

start project : python manage.py runserver

Database :

Models :

  • python manage.py migrate
  • python manage.py makemigrations app_name
  • python manage.py migrate

create superuser :

  • python manage.py createsuperuser

Use bootstrap in django forms

Password Authentication

  • install Bcrypt : pip install bcrypt
  • install Django Argon : pip install argon2-cffi

Inorder to work with images

  • install python imaging library : pip install pillow

Important Documentations :

Django other versions vs Django 3 conflicts :

  • from django.conf.urls import url vs from django.urls import path : url and path are not same !

  • Django 2.0 removes the django.core.urlresolvers module, which was moved to django.urls in version 1.10. You should change any import to use django.urls instead, like this:

      from django.urls import reverse
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment