Incident Management System Documentation
An Incident Management System specialized for Elections.
Get started now View it on GitHub
Getting started
Quick Start Local Setup For Developers
Dependencies
BACKEND
- Language: Python
- Framework: Django
FRONTEND
- Language: Javascript
- Framework: ReactJS
Quick start: Use Docker-Compose
BACKEND
- Make sure Docker is installed and running.
- Navigate to
/backend
directory on terminal. - Build the docker image
$ docker-compose build
- Create and run a new docker container instance.
$ docker-compose up
At the very first run django will start before mysql by which will result an error for django to start. Stop (
ctrl + c
) and re-run. - Open a new terminal (window/tab), navigate to
backend
folder - Run the migration to populate the data tables
$ docker-compose exec djangoapp python manage.py migrate
- Create superuser account and enter information when prompted.
$ docker-compose exec djangoapp python manage.py createsuperuser
- Run the seeder to populate data on the DB.
$ docker-compose exec djangoapp python manage.py loaddata category channel province district police politicalparty segment
- In order to add predefined users, run users seeder.
$ docker-compose exec djangoapp python manage.py loaddata users
You may skip this step to implement you own user hierarchy.
- Server now runs at http://localhost:8000/.
FRONTEND
- Make sure backend server is running.
- Navigate to
/frontend
directory on terminal. - Build the docker image
$ docker-compose build
- Create and run a new docker container instance.
$ docker-compose up
- Server now runs at http://localhost:3000/.
This is production build, runs locally, therefore not development friendly. For development purposes try Local Installation.
Local installation: for Development
BACKEND
- Make sure you have Python 3 and Mysql 8 installed. (for multiple versions you can use multiple environments with virtualenvwrapper).
- Navigate to
/backend
directory on terminal. - Create new database and update database connection data on
/backend/src/settings.py
or/backend/.env/
file (you can change the values in.env.example
and rename the file to.env
) - Install all necessary python packages along with Django.
$ pip install -r requirements.txt
- Run migrations for populate tables to DB.
$ python manage.py migrate
- Create superuser account and enter information when prompted.
$ python manage.py createsuperuser
- Run the seeder to populate data on the DB.
$ python manage.py loaddata category channel province district police politicalparty segment
- In order to add predefined users, run users seeder. You may skip this step to implement you own user hierarchy.
$ python manage.py loaddata users
- Run the server locally on port 8000 and point your web browser to http://localhost:8000 to view swagger view for API implementation.
$ python manage.py runserver 0.0.0.0:8000
Here you will now see only the public API list. You need to login on admin panel and visit back to baseurl (locally its: http://localhost:8000/) to see all API Endpoints
- Visit http://localhost:8000/admin and login using credentials of the superuser you created.
You may also use the Docker-Compose implementation for development, instead of these steps.
FRONTEND
- Make sure Node is installed and then backend API server is running.
- Set required configurations Check configuration options.
- Navigate to
/frontend
directory on terminal. - Install required packages
npm install
- Run the frontend server.
REACT_APP_API_BASE_URL=http://localhost:8000 npm start
- Server now runs at http://localhost:3000/.
Configure
About the project
An Incident Management System specialized for Elections specifically designed for and managed by Election Commission of Sri Lanka.
License
Incident Management System is distributed by an APACHE-2.0 license.
Contributing
When contributing to this repository, please first discuss the change you wish to make, by commenting on a particular issue, by email or by joining our mailling list via https://groups.google.com/forum/#!forum/lsf-elections before making a change.
Thank you to the contributors of Incident Management!
Code of Conduct
Incident Management System is committed to fostering a welcoming community for betterment and growth.
View our Code of Conduct on our GitHub repository.