DjangoEMS is a basic example of an Employee Management System (EMS) implemented with Django and Django REST Framework.
-
Create Virtual Environment:
- Create a virtual environment using:
virtualenv name_of_env
- Activate the virtual environment:
name_of_env/Scripts/activate.ps1
- Create a virtual environment using:
-
Install Dependencies:
- Install Django and Django REST Framework:
pip install django djangorestframework
- Install Django and Django REST Framework:
-
Start Project:
- Create a new Django project:
django-admin startproject name_of_project
- Change to the project directory:
cd name_of_project
- Create a new app within the project:
python manage.py startapp name_of_app
- Create a new Django project:
-
Configure Settings:
- Add the newly created app and 'rest_framework' to the
INSTALLED_APPS
insettings.py
.
- Add the newly created app and 'rest_framework' to the
-
Database Migration:
- Perform database migrations:
python manage.py makemigrations python manage.py migrate
- Perform database migrations:
-
Create Superuser:
- Create a superuser for administrative access:
python manage.py createsuperuser
- Create a superuser for administrative access:
-
Run Server:
- Start the development server:
python manage.py runserver
- Start the development server:
- Defined in
models.py
, consisting of three models: Teams, Employees, and Work_Arrangement.
- Defined in
serializer.py
, responsible for converting data types to JSON and vice versa.
- Defined in
views.py
, including API views for GET, POST, PUT, and DELETE operations.
- Defined in
urls.py
of the project, mapping to corresponding views.
- Register models in
admin.py
to manage data through Django's admin interface.
- Serializer: Converts data types to JSON and vice versa, facilitating communication between frontend and backend.
- API Views: Define operations such as GET, POST, PUT, and DELETE for interacting with the database.
- Testing: Utilize
test.py
for testing Django REST functionality.
- Use
test.py
to perform tests on the Django REST API. - Run tests using: