Skip to content
deby edited this page Feb 26, 2016 · 31 revisions

Our project is open-source and open for contributions. We would be more than happy to accept your pull-requests on GitHub.

The website has been made using Django, the facemash has been made using Pyramid, and the public API has been made using Django-Rest-Framework, so in Python 2. We also use LESS CSS, Bootstrap, JQuery and Bower for the front-end of the website.

If you wish to contribute but you don't know what to do, feel free to browse tasks that are ready to be implemented: Stories in Ready

Main contributors are db0 and Lamagicien.

School Idol Contest

Repository

SchoolIdolTomodachi/SchoolIdolContest

Contributors Guide

See School Idol Contest repo README

School Idol Tomodachi Website & API

Repository

SchoolIdolTomodachi/SchoolIdolAPI

Contributors Guide

Install the 1st time

# Install pre-requirements
# Debian, Ubuntu, and variants
apt-get install libpython-dev libffi-dev python-virtualenv libmysqlclient-dev nodejs
# Arch
pacman -S libffi python-virtualenv libmysqlclient nodejs

# Clone the repo
git clone https://github.com/SchoolIdolTomodachi/SchoolIdolAPI.git
cd SchoolIdolAPI

# Create a virtualenv to isolate the package dependencies locally
virtualenv env
source env/bin/activate

# Install packages, no need to be root
pip install -r requirements.txt

# Create tables, initialize database
python manage.py migrate

# Fill database with cards
python manage.py importcards noimages
# The `noimages` option will prevent downloading all the images, which may take hours.
# You can omit this option if what you're doing requires images.

# Compile localized messages
python manage.py compilemessages

# Download front-end dependencies
npm install -g bower less
bower install

# Compile LESS to CSS
lessc -x web/static/less/style.less web/static/css/style.css

Anytime

Reactivate the environment
source env/bin/activate
Launch the server
python manage.py runserver

If you want it to be externally visible, add an extra argument 0.0.0.0:8000.

No need to restart it to see your modifications, the server reloads itself automatically.

Whenever you change the models
python manage.py makemigrations
python manage.py migrate
Whenever you add messages that should be translated

Generate terms:

python manage.py makemessages -l ja --ignore=env/* --ignore=schoolidolapi/settings.py --ignore=api/models_languages.py --ignore=web/templates/registration/*

Then go to POEditor and import the tems. When the new terms are translated in all languages, generate the new files and put them in the repo. Either manually or using the POEditor integration.

Compile all languages

python manage.py compilemessages

Configure

To use your own configuration values, create a file schoolidolapi/local_settings.py and never commit it to the repo.

You may need to override those values:

In a production environment
# Production Basics
SECRET_KEY = 'random generated string to change in production'
TRANSFER_CODE_SECRET_KEY = 'random generated string used to encrypt transfer codes'
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['schoolido.lu']

# Production S3 (file storage)
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
AWS_STORAGE_BUCKET_NAME = 'schoolido.lu-assets'
IMAGES_HOSTING_PATH = 'http://s3-ap-northeast-1.amazonaws.com/schoolido.lu-assets/'

# Production SES (emails)
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_SES_REGION_NAME = 'us-east-1'
AWS_SES_REGION_ENDPOINT = 'email.us-east-1.amazonaws.com'
AWS_SES_RETURN_PATH = 'contact@schoolido.lu'
AWS_PASSWORD_EMAIL = 'password@schoolido.lu'

# Shrink images using tinypng API
TINYPNG_API_KEY = ''

# Use MySQL database (and not sqlite by default)
DATABASES = {
    'default': {
                    'ENGINE': 'django.db.backends.mysql',
                    'NAME': 'schoolidolu',
                    'OPTIONS': {'charset': 'utf8mb4'},
                    'USER': 'root',
                    'PASSWORD': '',
                    'HOST': 'localhost',
                    'PORT': '3306',
                }
}
In a testing environment
# To log all the 500 errors in the terminal:
LOGGING = {
    'disable_existing_loggers': False,
    'version': 1,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'level': 'DEBUG',
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['console'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
}

Commands

Commands to import games data from various websites

See all the sources used here: http://schoolido.lu/about/

Command line arguments available in almost all import scripts:

  • local Use local files instead of dowloading web pages (for development only)
  • redownload Will download the images (or details pages such as idols descriptions), even when they already have been downloaded and set in the database
  • noimages Do not download the images
Initial basic import
python manage.py importcards

Extra command line arguments:

  • delete Delete all cards, idols, songs and events

    import_en_events import_icons import_idols import_jp_events import_songs import_transparent import_transparent_images import_video_stories import_wikia importbasics importcards importcards_japanese importcardstats importcontest importvotes latlong migrate_activities migratelinks update_cached_objects verifyuser

Commands related to the site itself

Fill the database with users' location

To show locations on the map at /map/ (http://schoolido.lu/map/)

python manage.py latlong

Extra command line arguments:

  • reload will force reload all the locations in the database, even the ones already in. This is not recommended since OpenStreetMap has service restrictions.
Delete a user

Will delete a user, their accounts, the owned cards of their accounts, their activities, their event participations, and everything else associated with that user.

python manage.py deleteuser
Generate cached data to use in the website
Database cache
python manage.py update_cached_objects
  • Update total number of cards owner and people who have the card in their wishlist inside each card object
  • Update ranking positions of each card compared to each others (best of each attribute)
Settings cache
python manage.py generate_settings
  • Total donators, current contest, ages of users, cards statistics
In production, should be in a crontab together:
python manage.py update_cached_objects && python manage.py generate_settings
Get the list of usernames for a given email address
python manage.py getusername deby@schoolido.lu

school idol tomodachi

List of features

School Idol Tomodachi Cards

School Idol Tomodachi Profile

School Idol Tomodachi Activities

School Idol Tomodachi Events

School Idol Festival, the game

Help us!

Developers

Clone this wiki locally