Development

Requirements

Install Locally

codesy’s backend tries to be very slim, so starting should be easy. (Especially if you’re familiar with Django):

  1. Clone and change to the directory:

    git clone git@github.com:codesy/codesy.git
    cd codesy
    
  2. Create and activate a virtual environment:

    virtualenv env
    source env/bin/activate
    
  3. Install requirements:

    pip install -r requirements.txt
    
  4. Copy decouple config env file:

    cp .env-dist .env
    
  5. Migrate DB tables

    ./manage.py migrate
    
  6. Create a superuser:

    ./manage.py createsuperuser
    

Run locally with https

The codesy browser extensions contain content scripts that execute on https:// domains and request resources from the codesy domain. So, you need to run the backend over https://. The easiest way to run https connections with Django is to run stunnel on https://127.0.0.1:8443 in front of Django:

  1. First, install stunnel for your OS (E.g., on Mac OS brew install stunnel).

  2. Run Django dev server in HTTPS mode on port 5000:

    HTTPS=1 ./manage.py runserver 127.0.0.1:5000
    
  3. Generate local cert and key file for stunnel:

    openssl req -new -x509 -days 9999 -nodes -out stunnel/stunnel.pem -keyout stunnel/stunnel.pem
    
  4. Run stunnel with the included dev_https config:

    stunnel stunnel/dev_https
    
  5. Go to https://127.0.0.1:8443 and confirm the certificate exception.

Note

You always need to run both runserver and stunnel.

  1. Change the default django Site record from example.com to 127.0.0.1:8443

Read the Chrome Extension docs and the Firefox Add-on docs too learn how to configure them to use https://127.0.0.1:8443.

Finally, you’ll need to enable GitHub authentication ...

Enable GitHub Auth

To enable GitHub authentication, you can use our codesy-local OAuth app.

Add a django-allauth social app for GitHub:

  • Provider: GitHub
  • Name: codesy-local
  • Client id: c040becacd90c91a935a
  • Secret key: 08c3da1421bb280e6fa5f61c05afd0c3128a2f9f
  • Sites: example.com -> Chosen sites

Now you can sign in with GitHub at https://127.0.0.1:8443.

Payments

codesy is pre-configured to use the Stripe test marketplace. So, you can use the test credit card numbers from the Stripe docs.

Run the Tests

Install test requirements:

pip install -r requirements-test.txt

Running the test suite is easy:

./manage.py test -s --noinput --logging-clear-handlers

Working on Docs

Install dev requirements:

pip install -r requirements-dev.txt

Building the docs is easy:

cd docs
sphinx-build . html

Read the beautiful docs:

open html/index.html

What to work on

We have Issues.

If you are an active codesy user, we love getting pull requests that “scratch your own itch” and help the entire codesy community.