Code Monkey home page Code Monkey logo

chess-python-backend's Introduction

A Chess Game backend made with Django

For Documentation and reference to the Game design, see docs here

This project uses pre-commit and black for formatting.

Quick Start

Clone the repo:

with https

git clone https://github.com/wawanjohi/chess-python.git

or SSH

git clone [email protected]:wawanjohi/chess-python.git

or with Git CLI

gh repo clone wawanjohi/chess-python

Setup virtual env:

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.

Setup Channel Layers:

You can use in-memory channel layers, but be sure to move to a production-ready channel layer such as Redis.

Setting up InMemoryChannelLayer:

Add this to your Setting at config/settings.py

    CHANNEL_LAYERS = {
        "default": {
            "BACKEND": "channels.layers.InMemoryChannelLayer"
        }
    }

Setup channel layers to use Redis

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

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)],
            },
        },
    }

Setup pre commit:

Adjust the python version on .pre-commit-config.yaml to match yours (3.9.x recommended) on this line:
language_version: python3.x.x

Run Project

Migrate and create superuser:

python manage.py migrate
python manage.py createsuperuser

Run the project:

python manage.py runserver

Go to http://localhost:8000 to ping a move!

chess-python-backend's People

Contributors

wawanjohi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.