A simple application to create and manage pokebattle with REST API!
- Rest API Root: http://localhost:8000/api/
- Swagger Documentation: http://localhost:8000/swagger/
- Redoc Documentation: http://localhost:8000/redoc/
- You can go to the API Root from browser and browse through all available APIs.
This app use http token authentication to authenticate an user. To use any APIs you have to send authentication token in the http header.
- Ssend a post request with username and password to http://localhost:8000/token-auth/, you will get authentication token in response.
- Add the authentication token on the header of your subsequent API calls as bearer token to authenticate yourself.
This app leverages the following resources, but you don't need to worry about installing and configuring most of these. Just see prerequisites below for what you need on your machine to make this work:
- Docker - for virtual development environment and easy deployment
- Django - Python-based web framework
- DRF - A powerful and flexible toolkit for building Web APIs.
- VUE - The Progressive JavaScript Framework.
- PostgreSQL - A powerful, open source object-relational database system.
- Allauth - for user authentication
- sbadmin2 - A Free Bootstrap Template from Start Bootstrap.
As a prerequisite please make sure you have the following tools already installed on your machine:
- Clone this repo
git clone git@github.com:alihasanimam/pokebattle.git
- Build the Docker Container
cd pokebattle
docker-compose up --build
You should see all the resources including the web server startup in your terminal. When everything is complete, press Ctrl+C
to exit from docker-compose.
- Populate Postgres DB
docker-compose exec web python manage.py migrate
- Seed initial data from fixutres (optional)
docker-compose exec web python manage.py loaddata user/fixtures/*
Lunch the application
docker-compose up
Now go to localhost:8000/. That should be enough for you to run the project locally.
- Website: http://localhost:8000/
- Default Admin:
username: admin, password: adminadmin
- Default User:
username: user, password: useruser
Here is what your app should look like when you visit localhost:8000
.
With this app you can:
-
View your battle history. You can filter battles and delete any battle from the history.
-
After a battle, the app will show the winner and a record will be added in the battle history.
# rebuild docker container
docker build .
# start docker container
docker-compose up
# shutdown docker-container
docker-compose down
# generate db migrations
docker-compose exec web python manage.py makemigrations
# run db migrations
docker-compose exec web python manage.py migrate
# start new app
docker-compose exec web python manage.py startapp <app name>
# shell into docker container
docker-compose exec web python manage.py shell