/Django-Test

learing* Django 3.0

Primary LanguagePython

Django 3 !

I am learing from there : Python and Django Full Stack Web Developer Bootcamp

My learing app is hosted here : Practise App in Pythonanywhere

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
    
  • In OneToOneField() and Foreignkey() : on_delete=models.CASCADE field is required!

  • use from django.contrib.auth.views import LoginView insted of from django.contrib.auth import views and use LoginView.as_view() in the urlpattern insted of 'views.login'

Note : Baler update and you can get error :