Find census events and resources near you.
- Events and resources
- Partners can enter event information through forms
- Events are published to Google Calendar
- Export events via CSV
- Integrate with SwORD via CSV export
Instead of re-creating a calendar tool, we're leveraging a fantastic and proven one: Google Calendar.
Census Events creates a publishing workflow around Google Calendar. Currently, the publishing is one-way, from Census Events to Google Calendar.
Census Events will publish events to Google Calendar. You need to create a Calendar as well as a Service Account, to publish events on your behalf.
-
Make sure you are logged into Google with your G Suite account (you can also use your personal account if you don't have a G Suite organization).
-
Create a new Google API Project. Click on "My Project" at the top of the page to create a new project.
-
Create a Service Account for the project. Don't set any roles, they are not necessary.
-
Create a (JSON) key for the Service Account and save the JSON file. Treat this file as a secret, please don't commit it to GitHub. This JSON string should be provided to the application as the
GOOGLE_SERVICE_ACCOUNT_INFO
environment variable. You can edit by hand into a single line or use jq.$ jq -c . ./google-service-account.json
-
Enable the Calendar API for the API Project you just created.
-
Create a Google Calendar and share the calendar with your Service Account's email address. You can find your Service Account's email address in the IAM Admin. Allow the Service Account to "Make changes to events" to your calendar. To access sharing settings, open your Google Calendar settings and then click the calendar you just created from the left navigation under "Settings for my calendars".
-
Copy the Calendar Id from the settings in Google Calendar and set the environment variable
GOOGLE_CALENDAR_ID
.
In our event creation form we have the google autocomplete api available.
- Enable the Maps Javascript API
- Enable the Places API
- Create an API Key
- Under API restrictions, you may restrict it to use only the Maps Javascript API and the Places API
- In the
.env
file, copy your API key to theGOOGLE_MAPS_API_KEY
variable - You must link a billing account to your project
Reference: (Developer Reference)[https://developers.google.com/maps/documentation/javascript/places-autocomplete]
The application is configured through environment variables. You may set these
in .env
at the project root and they will be loaded automatically. Copy
env.sample
to .env
as a template.
Variable | Description | Required | Example |
---|---|---|---|
ALLOWED_HOSTS |
The list of hostnames to serve requests from. | N | app.example.com |
DATABASE_URL |
The connection settings for the database in URL form. | N | postgresql://user:password@hostname/db_name?options |
DJANGO_LOG_LEVEL |
Logging verbosity for django module. | N | INFO |
DEBUG |
When true, enable debugging features for development. | N | 1 |
GOOGLE_CALENDAR_ID |
The Google Calendar Id where events will be published. | N | [email protected] |
GOOGLE_SERVICE_ACCOUNT_INFO |
JSON string containing your Service Account credentials. | N | {"type": "service_account", ... } |
LOG_LEVEL |
Logging verbosity. | N | INFO |
SECRET_KEY |
A secret key to provide cryptographic signing for Django. | Y | rHNbX.W^)fw0eS_t]GYm4BsB::Gn?Va8cLA${wtKFvE2RZrR#, |
TIME_ZONE |
Set the server TZ to your local timezone. | N | America/Los_Angeles |
Thank you for considering a contribution to our project! Follow these instructions to get setup for development. Read over our CONTRIBUTING for more information on how we work.
- Python 3.6
- pipenv
We assume you are installing to a python virtualenv using pipenv.
Check your versions (optional):
$ python --version
$ python3 --version
$ pip --version
$ pipenv --version
ONLY do this in the dos-census-events directory. Ensure you are currenty in the project directory.
Initialize environment.
$ pipenv --python 3
Enter environment shell.
$ pipenv shell
Documentation resource: https://docs.python-guide.org/dev/virtualenvs/
For development, copy these settings to a .env
file in the project root
directory.
DEBUG=1
DATABASE_URL=sqlite:///db.sqlite3
SECRET_KEY=not-a-secret
Install python dependencies.
$ pipenv install --dev
Initialize the database.
$ python manage.py migrate
Create an admin user by following the prompts.
$ python manage.py createsuperuser
(Optional) for development you can load in some initial data.
$ python manage.py loaddata --app census events
Setup CSS file references with Django
$ python manage.py collectstatic
$ python manage.py runserver
Quit the server using CONTROL-C
Exiting the shell using CONTROL-D or
$ exit
Anytime you make a change to the models, you should try to run makemigrations to generate a database migration.
$ python manage.py makemigrations census
If any modifications were made to the Event model, you might need to update the initial data sample.
$ python manage.py dumpdata --indent 4 census.Event > census/fixtures/events.json