This project was built following the JustDjango - Getting Started With Django Tutorial // Build a CRM tutorial on youtube. It's a complete 9 hours django tutorial where I lean how to create a project with Django and in the end, how to deploy it on Ocean Digital.
From this tutorial, I learn how to use and differentiate views based on function and classes, how to manage migrations, how to use the jinja template, which is amazing, and how to use crispy forms with the tailwind template.
I was always curious to start a project with Django because it provides a rich boilerplate to build web applications so easily. I'm very grateful to follow this complete tutorial, because with the concepts learned here, I intend to use in future projects.
- Migrations
- Difference between project and app
- Models
- Forms
- Relationships
- Querysets and Managers
- Django Admin Interface
- Function and class based views
- Context
- URL Namespaces
- Generic Views
- Templates
- Tailwind CSS
- Static files
- Send emails
- Tests
- Auth permissions (Middlewares)
- Signals
- Mixins
- Crispy forms
- Environment Variables
- Potgresql
- Whitenoise
- Python 3.9
- Django 3.1.4
- Django Crispy Forms 1.11.2
- Crispy Tailwind 0.4.0
- Django Environ 0.4.5
- Postgresql
- psycopg2-binary 2.8.6
- Whitenoise 5.2.0
-
Download and configure the PostgreSQL database.
-
Login as default user:
sudo -i -u postgres
. -
Create a superuser:
CREATE USER username WITH PASSWORD 'password';
-
Login with the user created and create a database.
CREATE DATABASE database_name;
-
Grant all privileges to the user on the database created.
GRANT ALL PRIVILEGES ON DATABASE database_name TO username;
-
You can verify these operation accessing the database created.
psql -U username -h 127.0.0.1 database_name
It's highly recommended that you create a virtual environment to install these dependencies. You can use pipenv or venv. Once you create the virtual environment (optional), you can install the dependencies in two ways:
-
Using pipenv:
pipenv install
-
Using pip3:
pip3 install -r requirements.txt
To run this project you will need to set your own environment variables.
-
Create a new file named .env inside the djcrm folder.
-
Copy all variables inside jdcrm/.template.env and assign your own values to them.
-
Run
export READ_DOT_ENV_FILE=True
inside your terminal, so that your environment variables file will be read.
-
Run migrations:
python manage.py migrate
-
Run the server:
python manage.py runserver
-
Create a superuser:
python manage.py createsuperuser
This you create a user with super user privileges. You can access the Admin Dashboard on
http://127.0.0.1:8000/admin/
.
The server will be running on http://127.0.0.1:8000/
- Add the number of leads assigned to each category.
- Use Mailgun on production.
- Deploy on Digital Ocean.