Set Up Django Base Project
1. Clone repository
Section titled “1. Clone repository”# Use git clone on bash terminal to clone repositorygit clone https://github.com/darideveloper/django-base.git2. Set Up Environment
Section titled “2. Set Up Environment”On root you’ll find .env.example and .env.dev.example files, you can use them as template to create your own environment files, just remove .example from its name and fill the values.
3. Create virtual environment
Section titled “3. Create virtual environment”python -m venv venvActivate virtual environment (on windows)
venv\Scripts\activateActivate virtual environment (on linux)
source venv/bin/activateDeactivate virtual environment
deactivate4. Install dependencies
Section titled “4. Install dependencies”pip install -r requirements.txt5. Create postgre database
Section titled “5. Create postgre database”You can create your database from pgadmin or psql.
In case you want to use psql, access to postgres on terminal
psql postgresCreate database
CREATE DATABASE database_name;6. Database connection
Section titled “6. Database connection”6.1 Update db connection in .env.dev
Section titled “6.1 Update db connection in .env.dev”Update database credentials on .env.dev files
...DB_HOST=server ipDB_PORT=db free portDB_NAME=db nameDB_USER=db usernameDB_PASSWORD=db password...6.2 Run migrations and create superuser to check connection
Section titled “6.2 Run migrations and create superuser to check connection”Run migrations and create superuser
python manage.py makemigrationspython manage.py migratepython manage.py createsuperuserRun project in local to check admin login
python manage.py runserverEnter to localhost:8000/admin and access with admin credentials
7. Fixtures
Section titled “7. Fixtures”In case you need to import fixtures, you can use the following command:
python manage.py loaddataNOTE: YOU CAN FIN THIS REPOSITORY AT: https://github.com/darideveloper/django-base