This is a repository for a web application developed with Django, built with Crowdbotics
..
├── home # Starter home app
├── modules # Crowdbotics Modules app
├── testapiautosetting_138473 # Django project configurations
├── static # Static assets
├── users # Starter users app
├── web_build # React Native Web build
├── ...
├── README.md
└── ...
- Local Authentication using email and password with allauth
- Rest API using django rest framework
- Forgot Password
- Bootstrap4
- Toast Notification
- Inline content editor in homepage
Following are instructions on setting up your development environment.
The recommended way for running the project locally and for development is using Docker.
It's possible to also run the project without Docker.
This project is set up to run using Docker Compose by default. It is the recommended way. You can also use existing Docker Compose files as basis for custom deployment, e.g. Docker Swarm, kubernetes, etc.
-
Install Docker:
- Linux - get.docker.com
- Windows or MacOS - Docker Desktop
-
Clone this repo and
cd testapiautosetting_138473
-
Make sure
Pipfile.lock
exists. If it doesn't, generate it with:$ docker run -it --rm -v "$PWD":/django -w /django python:3.9 /bin/bash -c "pip3 install --no-cache-dir -q pipenv && pipenv lock"
-
Use
.env.example
to create.env
:$ cp .env.example .env
-
Update
.env
anddocker-compose.override.yml
replacing all<placeholders>
-
Create a secret and use it in you
.env
file asSECRET=<new generated secret>
.- Use
python -c 'from secrets import token_urlsafe; print("SECRET_KEY=" + token_urlsafe(50))'
to generate the random.
- Use
-
Start up the containers:
$ docker-compose up
This will build the necessary containers and start them, including the web server on the host and port you specified in
.env
.Current (project) directory will be mapped with the container meaning any edits you make will be picked up by the container.
-
Seed the Postgres DB (in a separate terminal):
$ docker-compose exec web python3 manage.py makemigrations $ docker-compose exec web python3 manage.py migrate
-
Create a superuser if required:
$ docker-compose exec web python3 manage.py createsuperuser
You will find an activation link in the server log output.
- Postgresql, or SQLite as an alterantive;
- Python;
- Install pipenv
- Clone this repo and
cd testapiautosetting_138473
- Run
pip install --user --upgrade pipenv
to get the latest pipenv version. - Run
pipenv --python 3.9
- Run
pipenv install
- Run
cp .env.example .env
- Create a secret and use it in you
.env
file asSECRET=<new generated secret>
.- Use
python -c 'from secrets import token_urlsafe; print("SECRET_KEY=" + token_urlsafe(50))'
to generate the random.
- Use
- Update .env file
DATABASE_URL
with yourdatabase_name
,database_user
,database_password
, if you use postgresql. Can alternatively set it tosqlite:////tmp/my-tmp-sqlite.db
, if you want to use sqlite for local development.
- Run
pipenv shell
- Run
python manage.py makemigrations
- Run
python manage.py migrate
- Start your
postgres
andredis
using docker services:
$ docker-compose up postgres redis
You can now use their exposed ports in your .env
file;
- Run
python manage.py runserver
- Create a superuser if required:
You will find an activation link in the server log output.
$ python manage.py createsuperuser
Admin Panel can be accessed through http://localhost:8000/admin/. If you are the Project Owner, admin credentials can be generated from App > Settings on Crowdbotics App Dashboard. If not, please request your PM or Project Owner to generate admin credentials and share with you.
API Documentation is generated automatically and can be access through http://localhost:8000/api-docs/. Please make sure you are signed in to the admin panel before navigating to this page.
The Django Backend is pre-configured to enabled certain security configurations through the use of environment variables. This can be done through the Crowdbotics Dashboard's App Settings page.
-
https://docs.djangoproject.com/en/3.2/ref/settings/#secure-ssl-redirect
SECURE_REDIRECT = True