This is a repository for a web application developed with Django, built with Crowdbotics
..
├── home # Starter home app
├── modules # Crowdbotics Modules app
├── demo_35152 # Django project configurations
├── static # Static assets
├── users # Starter users app
├── web_build # React Native Web build
├── ...
├── README.md
└── ...
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:
Clone this repo and cd demo_35152
Make sure Pipfile.lock
exists. If it doesn't, generate it with:
$ docker run -it --rm -v "$PWD":/django -w /django python:3.7 pip3 install --no-cache-dir -q pipenv && pipenv lock
Use .env.example
to create .env
:
$ cp .env.example .env
Update .env
and docker-compose.override.yml
replacing all <placeholders>
python -c 'from secrets import token_urlsafe; print("SECRET_KEY=" + token_urlsafe(50))'
to generate the random SECRET_KEY
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.
cd demo_35152
pip install --user --upgrade pipenv
to get the latest pipenv version.pipenv --python 3.6
pipenv install
cp .env.example .env
DATABASE_URL
with your database_name
, database_user
, database_password
, if you use postgresql.
Can alternatively set it to sqlite:////tmp/my-tmp-sqlite.db
, if you want to use sqlite for local development.pipenv shell
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
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.