- fms
This project is an API for managing forms and form responses, built using Django Rest Framework and MongoEngine with MongoDB as the database.
- Create, retrieve, update, and delete forms.
- Docker
- Docker Compose
docker-compose.yml have two services:
-
app: Runs the Django server.
-
mongodb: MongoDB instance for database.
-
The app service runs Django using the
python manage.py runserver 0.0.0.0:8000 -
The mongodb service runs MongoDB, exposed on port
27017.
-
Clone the repository:
git clone https://github.com/thejonasjon/fms.git cd fms -
Create environment variables (optional but recommended): Create a
.envfile at the root of the project with the following variables, or adjust thedocker-compose.ymlfile directly:# .env file MONGO_DB_NAME=fms_db MONGO_DB_HOST=mongodb MONGO_INITDB_ROOT_USERNAME=changeme MONGO_INITDB_ROOT_PASSWORD=changeme -
Build and run the containers:
docker-compose up --build
```bash
docker-compose run --rm app python manage.py test
```
GET /api/forms/: List all forms.POST /api/forms/: Create a new form.GET /api/forms/{id}/: Retrieve a specific form.PUT /api/forms/{id}/: Update a form.DELETE /api/forms/{id}/: Delete a form.
POST /api/responses/submit/: Submit a response to a form.GET /api/responses/: Retrieve all submitted responses.
POST /api/swagger/: Access API documentation on Swagger.
- Django: Python web framework.
- Django Rest Framework: API creation with Django.
- MongoEngine: MongoDB ORM for managing MongoDB in Django.
- MongoDB: NoSQL database for storing forms and responses.
- Docker: Containerization for environment consistency.
In the project, development dependencies are separated into
- `requirements.dev.txt`. For Development
- `requirements.txt`. For Production