Skip to content
πŸ€– The Okuna Social Network API
Python HTML Other
Branch: master
Clone or download
uiboy Merge pull request #574 from OkunaOrg/enhancement/exclude-users-commu…

Enhancement/exclude users communities from tab
Latest commit 2fb5839 Oct 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci πŸ’š change cache prefix Sep 10, 2019
.docker Update compnay name references because facebook -_- Aug 10, 2019
.ebextensions πŸ› fix supervisord stop Oct 12, 2019
.elasticbeanstalk πŸ‘· add deploy circle ci job Nov 3, 2018
docs πŸ“ πŸ’¬ Change Openbook to Okuna and update the links Oct 1, 2019
locale 🌐 add missing locales Sep 20, 2019
media πŸ”§ add collect media fixtures Dec 20, 2018
openbook ♻️ add default, high and low rq queues and use accordingly Oct 10, 2019
openbook_auth ✨ add exclude_joined_communities boolean to api Oct 14, 2019
openbook_categories 🌐 add dutch, danish and hungarian to languages Sep 9, 2019
openbook_circles ♻️ add global custom testcase which mocks sending push notifications Aug 22, 2019
openbook_common Merge branch 'master' into feature/432-top-posts-feed-api Sep 20, 2019
openbook_communities πŸ‘Œ code review comments, change some func names and fix misses Sep 26, 2019
openbook_connections ♻️ add global custom testcase which mocks sending push notifications Aug 22, 2019
openbook_devices ♻️ add global custom testcase which mocks sending push notifications Aug 22, 2019
openbook_follows ♻️ add global custom testcase which mocks sending push notifications Aug 22, 2019
openbook_importer ♻️ add global custom testcase which mocks sending push notifications Aug 22, 2019
openbook_invitations 🚸 update user invite templates Oct 3, 2019
openbook_lists ♻️ add global custom testcase which mocks sending push notifications Aug 22, 2019
openbook_moderation 🌐 add dutch, danish and hungarian to languages Sep 9, 2019
openbook_notifications ♻️ add default, high and low rq queues and use accordingly Oct 10, 2019
openbook_posts ⚑️ tweak trending posts query performance Oct 16, 2019
openbook_tags ♻️ remove community circle Feb 8, 2019
openbook_translation βœ… update mockstrategyclass Aug 2, 2019
utils πŸ€¦β€β™‚ Yeah seriously... Jun 1, 2019
video_encoding Revert "πŸ› fix can't delete post if file no longer exists" Oct 10, 2019
.bandit πŸ”§ skip django video encoder from bandit Sep 11, 2019
.coveragerc πŸ’š omg try to omit venv again! Oct 11, 2018
.env.sample πŸ› fix max file size for tests Sep 10, 2019
.gitignore ✨ add status API Aug 22, 2019 πŸŽ‰ Oh boy, here we go. Oct 3, 2018
LICENSE πŸŽ‰ Oh boy, here we go. Oct 3, 2018
Makefile 🌐 add .po file with more strings Aug 7, 2019
Pipfile ⬆️ add shutilwhich to dependencies Sep 30, 2019
Pipfile.lock ⬆️ add shutilwhich to dependencies Sep 30, 2019 πŸ“ add docs on the curated posts jobs Oct 10, 2019
docker-compose.override.yml.dist Add .dist file for docker environment overrides Jun 1, 2019
docker-compose.yml Default character set to `utf8` and collation to `utf8_unicode_ci` Sep 1, 2019 πŸŽ‰ Oh boy, here we go. Oct 3, 2018
requirements.txt ⬆️ add shutilwhich to dependencies Sep 30, 2019

Okuna logo

CircleCI Maintainability Test Coverage gitmoji badge

The API server for Okuna.

Table of contents


Project overview

The project is a Django application.


There are many different ways to contribute to the website development, just find the one that best fits with your skills and open an issue/pull request in the repository.

Examples of contributions we love include:

  • Code patches
  • Bug reports
  • Patch reviews
  • Translations
  • UI enhancements

Code of Conduct

Please read and follow our Code of Conduct.


Every contribution accepted is licensed under AGPL v3.0 or any later version. You must be careful to not include any code that can not be licensed under this license.

Please read carefully our license and ask us if you have any questions.

Responsible disclosure

Cyber-hero? Check out our Vulnerability Disclosure page.

Other issues

We're available almost 24/7 in the Okuna slack channel. Join us!

Git commit message conventions

Help us keep the repository history consistent πŸ™!

We use gitmoji as our git message convention.

If you're using git in your command line, you can download the handy tool gitmoji-cli.

Getting started

Clone the repository

git clone

Create and configure your .env file

cp .env.sample .env
nano .env

Install the dependencies

pipenv install

Activate the pipenv environment

pipenv shell

Run the database migrations

python migrate

Collect the media fixtures

python collectmedia

Load the fixtures

python loaddata circles.json emoji-groups.json emojis.json badges.json categories.json languages.json

Serve with hot reload

For local API development it suffices to bind the server to localhost:

python runserver

For app development you have to bind the server to your local network:

python runserver

Spawn an rq-worker

We use rq-workers to process media, deliver push notifications and more.

python rqworker

Spawn an rq-scheduler

We use rq-schedulers to run one time or repetitive tasks like cleaning up failed to upload posts.

python rqscheduler

To schedule a job, go to the /admin/scheduler route.

The available jobs are

Cleans up all draft posts which have not being modified for a day.

Should be run every hour or so.

Curates the top posts, which end up in the explore tab.

Should be run every 5 minutes or so.

Cleans the top posts which should no longer be top posts.

This happens if an item is soft deleted, reported and approved

Should be run every 5 minutes or so.

Django Translations

  1. Use ./ makemessages -l es to generate messages. Doesn't matter which language we target, the translation tool is agnostic.
  2. This generates a new django.po file in the locale/es/LC_MESSAGES/ folder. It will have all the source strings and a place to enter the translation strings. It doesnt overwrite previous translations.
  3. Sometimes, if django is confused, it marks a string as fuzzy. So do search for the word 'fuzzy' in django.po
  4. If you find a fuzzy string, you can resolve it manually. Finally each string should like this
#: openbook_lists/   <- place where the string occurs in code
msgid "The list does not exist."     <- english translations  
msgstr "Die Liste ist nicht vorhanden."   <-- this will be empty for new strings
  1. Upload this django.po file to by pressing Update next to the existing django.po file.
  2. Once all language volunteers have translated the new strings, download all the django.po files for each locale and put them in their respective folders.
  3. Run ./ compilemessages to auto-generate files.
  4. You need to checkin both django.po and files for each locale.

Django Custom Commands create_invite

Creates a user invite and outputs its token. Required for creating a new account.

usage: create_invite [-h] [--email EMAIL] [--username USERNAME] [--name NAME] [--badge BADGE] import_invites

Imports user invites from a kickstarter/indiegogo csv

usage: import_invites [-h] [--indiegogo PATH_TO_CSV] [--kickstarter PATH_TO_CSV] send_invites

Send invite emails to all user invites who have not been sent the email.

usage: send_invites [-h] allocate_invites

Assign user invites to all or specific users.

usage: allocate_invites [-h] [--count INCREMENT_INVITES_BY_COUNT] [--total TOTAL_INVITE_COUNT_TO_SET] [--username USERNAME] create_post_media_thumbnails

Creates media_thumbnail, media_height and media_width for items which don't have it using the Post -> PostMedia relationship.

The command was created as a one off migration tool.

usage: create_post_media_thumbnails migrate_post_images

Migrates Post -> PostImage to Post -> PostMedia -> PostImage.

The command was created as a one off migration tool. import_proxy_blacklisted_domains

Import a list of domains to be blacklisted when calling the ProxyAuth and ProxyDomainCheck APIs.

usage: import_proxy_blacklisted_domains [--file The path to the file with the domains to import]


python import_proxy_blacklisted_domains --file ./openbook_common/misc/domain_blacklists/porn/domains flush_proxy_blacklisted_domains

Flush all of the blacklisted proxy domains

usage: flush_proxy_blacklisted_domains

Crowdin translations update

Download the latest django.po files in the respective locale/ folders from crowdin. Then locally run all or some of these commands depending on which models need updating. It will update the .json files, then check them in.

./ shell < openbook_common/i18n/
./ shell < openbook_common/i18n/
./ shell < openbook_moderation/i18n/
./ shell < openbook_categories/i18n/

Docker Compose

Replace .env settings

# Relational Database Service configuration

Build the container

usage: docker-compose build

Run the container

usage: docker-compose up (-d in background)

Visit the static webserver IP


Copy docker-compose.override.yml.dist to docker-compose.override.yml to override any settings. By default it will override the network information and fallback to localhost:80/443/3306. Docker-Compose YML Reference



The pipenv install command fails

You probably installed openssl via Homebew, make sure to follow the instructions that are given when you type brew info openssl.


Double logging in console

The local development server runs a separate process for the auto-reloader. You can turn off the auto-reload process by passing the --noreload flag.

python runserver --noreload

Happy coding πŸŽ‰!

You can’t perform that action at this time.