Welcome¶
codesy is a platform for fixing and funding open source software..
The code for codesy’s API backend combines:
- GitHub Authentication (via django-allauth)
- Stripe payments (via Stripe.js)
- codesy variation of Nate Oostendorp’s “Concurrent Sealed Bid Auction” system and CodePatron concept.
Resources¶



Code: | |
---|---|
License: | AGPLv3; see LICENSE file |
Documentation: | |
Issues: | |
IRC: | |
Mailing list: | |
Servers: | https://codesy-stage.herokuapp.com/ (stage) https://api.codesy.io/ (prod) |
Contents¶
Development¶
Install Locally¶
codesy’s backend tries to be very slim, so starting should be easy. (Especially if you’re familiar with Django):
Clone and change to the directory:
git clone git@github.com:codesy/codesy.git cd codesy
Create and activate a virtual environment:
virtualenv env source env/bin/activate
-
pip install -r requirements.txt
Copy decouple config env file:
cp .env-dist .env
Migrate DB tables
./manage.py migrate
-
./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:
First, install stunnel for your OS (E.g., on Mac OS
brew install stunnel
).Run Django dev server in HTTPS mode on port 5000:
HTTPS=1 ./manage.py runserver 127.0.0.1:5000
Generate local cert and key file for stunnel:
openssl req -new -x509 -days 9999 -nodes -out stunnel/stunnel.pem -keyout stunnel/stunnel.pem
Run stunnel with the included
dev_https
config:stunnel stunnel/dev_https
Go to https://127.0.0.1:8443 and confirm the certificate exception.
Note
You always need to run both runserver
and stunnel
.
- Change the default django Site record from
example.com
to127.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
Editing the Website Theme via SASS¶
The theme is built and compiled using [SASS](https://sass-lang.com/ruby-sass). The SCSS files only compile the Codesy website CSS file. To edit the Widget or the iFrame, edit their CSS files directly.
Install requirements:
gem install sass
To compile the assets:
cd static/css
sass --watch scss/codesy-home.scss:codesy-home.css
Note
Add the flag, –watch, to recompile assets when any assosiated files are saved.
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.
Deployment¶
codesy is designed with 12-factor app philosophy to run on heroku, so you can easily deploy your changes to your own heroku app with heroku toolbelt.
Deploy your own¶
Create a heroku remote. We suggest naming it codesy-username:
heroku apps:create codesy-username
Set a
DJANGO_SECRET_KEY
on heroku that’s unique to you.:heroku config:set DJANGO_SECRET_KEY="username-birthdate"
Set other required environment variables for heroku:
heroku config:set DJANGO_DEBUG=True heroku config:set ACCOUNT_EMAIL_VERIFICATION=none heroku config:set ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'
Push code to the heroku remote:
git push heroku master
Migrate DB tables:
heroku run python manage.py migrate
Create a superuser:
heroku run python manage.py createsuperuser
Set the site domain name: Go to /admin/sites/site/1/change/ and make it match
codesy-username.herokuapp.com
To enable GitHub sign-ins on your heroku domain, use the following settings to register your own GitHub App:
- Application name: codesy-username
- Homepage URL: https://codesy-username.herokuapp.com/
- Application description: username’s codesy
- Authorization callback URL: https://codesy-username.herokuapp.com/accounts/github/login/callback/
Note
You must use https
Now go to https://codesy-username.herokuapp.com/admin/socialaccount/socialapp/add/ to `enable GitHub Auth`_ on your heroku domain, using your new GitHub App Client ID and Secret
Note
Remember to use https
That’s it. https://codesy-username.herokuapp.com/ should work.
Configure backing services¶
To enable email via SendGrid, set
SENDGRID_USERNAME
andSENDGRID_PASSWORD
config values:heroku config:set SENDGRID_USERNAME= heroku config:set SENDGRID_PASSWORD=
To enable Stripe, you will need to set
STRIPE_SECRET_KEY
andSTRIPE_PUBLIC_KEY
values from Stripe Dashboard API Keys:heroku config:set STRIPE_SECRET_KEY= heroku config:set STRIPE_PUBLIC_KEY=
To enable PayPal, you will need to set
PAYPAL_CLIENT_ID
andPAYPAL_CLIENT_SECRET
value from PayPal Developer Dashboard Apps & Credentials:heroku config:set PAYPAL_CLIENT_ID= heroku config:set PAYPAL_CLIENT_SECRET=
Configure extensions to use the server¶
Check the extension docs.
Deploying to production¶
We use Travis CI for continuous deployment to Heroku. Our .travis.yml defines the flow:
- Commits to
master
are tested on Travis. - If/when the build passes, the code is automatically deployed to https://codesy-stage.herokuapp.com
- To deploy changes to production, a repo owner pushes a commit to the
production
branch on GitHub.
This means anyone can request a production deployment by submitting a Pull Request from master
to production
.