Get Locations is a Python Django application that retrieves the list of locations in the following format:
{
'data':[
{
'state': 'Karnataka'
'districts': [
{
'id':1,
'name':'Bagalkot',
'pincode':'587101'
},
{
'id':2,
'name':'Bengaluru Rural',
'pincode':'560066'
}
...
]
},
.....
]
}
The admin user has the privilege to add new locations to the database.
-
Install all the required packages(python modules):
pip install -r requirements.txt
(Assuming that you have created a virtual environment) -
Migrate all the models to the database(database is included in the code- db.sqlite3)
python manage.py migrate
-
When the migrations are successfully completed, we can run the server:
python manage.py runserver
If the steps are followed correctly, the server will be up and running.
-
To gather all static files:
python manage.py collectstatic
-
To login to admin panel, we have to create a superuser:
python manage.py createsuperuser
(default- username: root, password: root)User can log into the Admin Panel using the following url(assuming that you are on local server):
127.0.0.1:8000/admin/ (local instance)
<base_url>/locations/
list of all locations in the format mentioned above. (127.0.0.1:8000/locations/ on local instance)