DEV Community

loading...

How To Start Web Development With Django 3.0.4

5hfT
I'm a Quick Learner | Love to Write Code | Learn new Tech stuffs | Find Peace in Solving or Fixing an Error. ~Every code matters !~
・2 min read

Creating a virtual setup for Django

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 makemigration 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

Important Documentations :

interested people can view my learning repo in github here Django-Test

Discussion (9)

Collapse
patarapolw profile image
Pacharapol Withayasakpunt • Edited

At this point of time, I am not even sure if Virtual Environment should be used for Django. (Not mentioned in official doc, but mentioned in Django Girls.)

If not using Virtual Env, Docker should be used at the very least, I believe.

Also, I have never tried Conda, only bare minimum Python.

Collapse
demianbrecht profile image
Demian Brecht

Why wouldn't you want to use virtual envs for Django? I use them regularly (at least, when not running in a container).

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

Just to say that, for some reasons, virtualenv is not mentioned in the official website.

Thread Thread
mh_shifat profile image
5hfT Author

At its core, the main purpose of Python virtual environments is to create an isolated environment for Python projects. This means that each project can have its own dependencies, regardless of what dependencies every other project has.
The great thing about this is that there are no limits to the number of environments you can have since they’re just directories containing a few scripts. Plus, they’re easily created using the virtualenv or pyenv command line tools.

Collapse
highcenburg profile image
Vicente G. Reyes

Every project should have a virtualenv because every project has different version dependencies.

Collapse
yaser profile image
Yaser Al-Najjar

Believe me and just use the virtualenv, even with dev env in docker... Cuz you need to mount the volume of your venv to not install the dependencies again everytime you restart the container.

Collapse
sobolevn profile image
Nikita Sobolev • Edited

Check out wemake-django-template: it is a bleeding edge django template focused on code quality and security.

It allows to jump start your new project filled with best practices, tools, and documentation with just two commands.

Some features:

  • Always up-to-date with the help of @dependabot
  • Supports latest python3.7+
  • poetry for managing dependencies
  • mypy and django-stubs for static typing
  • pytest and hypothesis for unit tests
  • flake8 and wemake-python-styleguide for linting
  • docker for development, testing, and production
  • sphinx for documentation
  • Gitlab CI with full build, test, and deploy pipeline configured by default
  • Caddy with https and http/2 turned on by default

GitHub logo wemake-services / wemake-django-template

Bleeding edge django template focused on code quality and security.

wemake-django-template

wemake.services Awesome Build status Documentation Status Dependencies Status wemake-python-styleguide

Bleeding edge django2.2 template focused on code quality and security.


Purpose

This project is used to scaffold a django project structure Just like django-admin.py startproject but better.

Features

Installation

Firstly, you will need to install dependencies:

pip install cookiecutter jinja2-git

Then, create a project itself:

cookiecutter gh:wemake-services/wemake-django-template

Who are using this template?

If you use our template, please add yourself or your company in the list.

We offer free email support for anyone who is using this If you have any problems or questions,…

Collapse
calag4n profile image
calag4n

I used to use conda with a django project but when I wanted to make a requirements.txt file, it comes too many packages that you didn't want to be there.
Is there a way to fix that?

However, I now use pipenv which combine virtual environments and package manager for Django projects and kept ananconda for AI ones.

Collapse
abhi14nexu profile image
abhi14nexu

thanxx bro....that was really helpful