Welcome to CodeDoor! This repository holds everything needed to run an instance of the CodeDoor web application locally.
See the first time setup guide for a full walkthrough.
- Clone this repository and cd into the root directory.
 - Create a virtual environment with 
python3 -m venv env. - Activate the virtual environment with 
source env/bin/activate. - Install the project dependencies with 
pip install -r requirements.txt. - Start a Postgres server with 
service postgresql start. - Build migration scripts with 
python manage.py makemigrations codedoor. - Run 
python manage.py migrateto create the CodeDoor database and schema in the postgres DB backend. - Create a file called 
api_keys.pyin the root directory with the correct credentials (see: "Developing Locally" for local credentials). - To setup automatic SASS compilation, add the following to 
settings.py: 
from django.conf import settings
...
INSTALLED_APPS = [
    …
    'sass_processor',
    …
]
...
STATICFILES_FINDERS = settings.STATICFILES_FINDERS + ['sass_processor.finders.CssFinder']- Run 
python manage.py runserverto run the server. - Go to 
localhost:8000to see it in action! 
After installation of dependencies, to run a development server:
- Activate the virtual environment with 
source env/bin/activate. - Start a Postgres server with 
service postgresql start. - Run 
python manage.py runserverto run the server. - Go to 
localhost:8000to see it in action! 
CodeDoor runs on top of the Django web framework and uses Postgres as a backing database. The Slack OAuth API is used for login; our Slack developer account contains keys as well as the callback URL, which is set to point to our production server.
For static files like profile pictures, we currently use Amazon S3 as a backing store. The production server is deployed on Heroku at (http://codedoordev.herokuapp.com). Please message Brian or Andrew on Slack for more details about credentials or deployment.
The original CodeDoor design can be viewed on Figma.
There is a lot to fix! If you would like to contribute, please work using feature branches forked from master.
Suggested workflow:
- Fork a branch from 
master. - Make and commit your changes. There is no style guide currently.
 - Submit a pull request on GitHub from your branch into 
master, putting Andrew Chan as your reviewer. - Andrew will review your change and merge it.
 
Please message Andrew on Slack if you have any questions about the contribution process.
You can run a local instance of CodeDoor by following the steps in the Installation section. You'll need access to the Slack credentials for the local-only Slack app - look in the slack channel or message Andrew for more. Note that these credentials are different from the production server's credentials, which are associated with a Slack app that redirects to the production server.
You'll also need our Amazon S3 credentials, which can be found in the slack channel. Once you have these credentials,
create a file in the project root directory called api_keys.py with the following:
s3_access_keys = {
    "id": "<S3_ID>",
    "secret": "<S3_SECRET>"
}
slack_access_keys = {
    "client_id" : "<SLACK_ID>",
    "client_secret" : "<SLACK_SECRET>"
}
absolute_url = "http://localhost:8000"Styling is done using SASS compiled on-the-fly. Instead of running a daemon to watch our SCSS files for changes, we use django-sass-processor. This means that instead of using
<link rel="stylesheet" href="{% static '/styles/example.css' %}" />to import stylesheets, we use a new templatetag
{% sass_src 'styles/example.scss' %}which will compile the given *.scss file into *.css and render the final template code as the HTML:
<link href="/static/styles/example.css" rel="stylesheet" />Note that because we are using a new templatetag, we must load this tag in the base template (already done). Since most pages will extend the base template, no further action is needed. If you are working on the frontend, make sure to checkout the style examples documentation.
You are now ready to run a local instance of CodeDoor.
Our production instance runs on Heroku and uses different credentials than the local instances; these are passed to the program using environment variables. The following variables need to be set:
absolute_url=https://codedoordev.herokuapp.com/
DATABASE_URL=postgres://<DATABASE_USER>:<DATABASE_PASSWORD>@<DATABASE_HOST>
production=True
s3_id=<S3_ID>
s3_secret=<S3_SECRET>
slack_id=<SLACK_ID>
slack_secret=<SLACK_SECRET>
Automatic deploys have not been set up.