Django Girls website
This repository contains sources of Django application that powers DjangoGirls.org.
What's in it?
It's a simple CMS that contains 4 models:
- Event - a list of events and their website configuration
- EventPageContent - blocks of content that are visible on the website
- EventPageMenu - items of menu of every website
How to create new event?
Simply go to command line and run this command:
python ./manage.py new_event
And then follow the instructions.
How to manage your website?
Here you can change:
- Meta tags - title and description of the website
- Main color - main color on the website in HEX (default is FF9400)
- Custom CSS - customize CSS on the website
- URL - url that goes after the domain (http://djangogirls.org/__url__)
- Is live? - live website is available on the homepage and can be accessed by anyone
Each website comes with some default content that you can adjust to your needs. Each object is a "block" on the website that you can modify in following ways:
- Name - it's also a permalink that you can link to like this: #name
- Content - HTML is allowed
- Background - there are two available types of blocks: without background and with background. By uploading image you're choosing the type with background.
- Is public - check this if you want this block to be visible
To manage menu available on the website, you can add objects to EventPageMenu. Available options:
Contributing to Django Girls website
The website is hosted on PythonAnywhere and is available here: http://djangogirls.org/
Please note that we use Python 3 only, so make sure that you use correct version when running commands below.
Setting up a development environment
First, clone the repository:
git clone email@example.com:DjangoGirls/djangogirls.git
Step into newly created
Create a new virtual environment if needed. Then, install all the required dependencies:
pip install -r requirements.txt
psql shell, create a database and a role with the necessary permissions:
CREATE DATABASE djangogirls; CREATE ROLE postgres; GRANT ALL privileges ON DATABASE djangogirls TO postgres; ALTER ROLE postgres WITH LOGIN;
Run the migration to create database schema:
Load sample data to the database
./manage.py loaddata sample_db.json
Create a user so you can login to the admin:
Install dependencies for static files:
Compile CSS and JS files:
Run your local server:
Run the tests
You can run the tests like this:
Or if you want coverage reports:
For a coverage report with information about missing lines, run this:
py.test --cov-report term-missing --cov
You will need to install
pip install pip-tools
requirements.in into a new list of requirements:
To try and update a particular dependency:
pip-compile -P django
You can also tell it to try and update all the dependency versions:
Please note that
pip-compile will not install or upgrade any packages. You
still need to install them separately.
pip-tools also provides a tool that will install all required packages and
uninstall all packages that are not explicitly required. This can prove useful
when removing dependencies to make sure no code tries to import them:
This means you shouldn't change any css files, but
.styl files. They're in /static/source/css/ directory.
.styl files to
We're also using gulp for our static files builds. To build static files for production, run this:
For local development:
Hosting on PythonAnywhere
Key bits of config and secrets are stored in environment variables in two places:
- in the WSGI file (linked from the Web Tab)
- in the virtualenv postactivate at ~/.virtualenvs/djangogirls.com/bin/postactivate
Google Apps API integration
We're using Google Apps Admin SDK for creating email accounts in djangogirls.org domain automatically.
Several things were needed to get this working:
- Create an app in Developer Console
- Create a service account to enable 2 legged oauth (https://developers.google.com/identity/protocols/OAuth2ServiceAccount)
- Enable delegation of domain-wide authority for the service account.
- Enable Admin SDK for the domain.
- Give the service account permission to access admin.directory.users service (https://admin.google.com/AdminHome?chromeless=1#OGX:ManageOauthClients).