For Documentation and reference to the Game design, see docs here
This project uses pre-commit and black for formatting.
- Clone Repo
- Setup Virtual Env
- Setup Channels
- Setup Database and Firebase
- Setup Superuser
- Running the project
- Conclusion
with https
git clone https://github.com/wawanjohi/chess-python.git
or SSH
git clone git@github.com:wawanjohi/chess-python.git
or with Git CLI
gh repo clone wawanjohi/chess-python
Linux or Mac:
virtualenv venv && source venv/bin/activate
Windows:
Create the environment venv
and run this on powershell:
.\venv\Scripts\Activate.ps1
While at it, copy .env.example
to .env
and prepopulate the values as you need to.
You can use in-memory channel layers, but be sure to move to a production-ready channel layer such as Redis.
Add this to your Setting at config/settings.py
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer"
}
}
Make sure Redis is installed and working on your machine. This works out of the box on Mac or Linux.
Ubuntu/Debian
sudo apt install redis
Arch/Manjaro
sudo pacman -S redis
Fedora
sudo dnf -y install redis
Install with Snap (Compatible with most linux Distros)
sudo snap install redis
For Windows, you will either have to use Docker or other third-party ways for connecting to a linux environment as Redis doesn't work out of the box.
docker run -it --name chess-python-redis -d redis
I'd highly recommend that you use Memurai if you don't intend to use Docker
Add this to your settings at config/settings.py
:
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
},
},
}
Adjust the python version on .pre-commit-config.yaml
to match yours (3.9.x recommended) on this line:
language_version: python3.x.x
Migrate and create superuser:
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
Go to http://localhost:8000 to ping a move!