-
Notifications
You must be signed in to change notification settings - Fork 0
Work Step
mushfiqur-rahman edited this page Jun 28, 2023
·
1 revision
- venv
- manage.py
- core
- setting
- base.py (base settings)
- local.py
- production.py
- setting
- To run project
$ (venv) PS blogger>> manage.py runserver
-
Added condition to manage.py for DEBUG true or false condition
-
Secret key generate command
$ .\manage.py shell
>>> from django.core.management.utils import get_random_secret_key
>>> print(get_random_secret_key())
>>> exit()
-
Install python-dotenv
-
Create .env within the project directory. File stracture
blogger
core > .env
and put the code
SECRET_KEY =SECRET_KEY
DEBUG = True
- Add below line into the base.py file
from dotenv import load_dotenv
import os
SECRET_KEY = os.environ.get('SECRET_KEY')
DEBUG = os.environ.get('DEBUG') == 'True'
- install pytest-django and create a file at root directory as name
pytest.ini
- To run test use below command
pytest
- Create a new app
$ (venv) PS D:blogger> ./manage.py startapp blog
- install pip pytest cov
pytest --cov
pytest --cov-report html --cov=./
- After configure Factory boy
(venv) PS D:\PROJECT\djblogger> py manage.py shell
>>> from blog.factory import PostFactory
>>> x = PostFactory.create_batch(200)
>>> exit()
render PostgreSQL setup
> set DATABASE_URL= internal or external database link