Skip to content

Website settings

deby edited this page Nov 24, 2021 · 27 revisions

← Previous: Default pages

Your settings file is located in ${PROJECT}/settings.py.

Required settings:

Setting About
ACCOUNT_MODEL Your custom model to handle game accounts (models.Account). It's highly recommended to make it inherit from magi.abstract_models.BaseAccount.
COLOR The dominant hex color of the website
DISQUS_SHORTNAME Go to Disqus to create a new website and provide the shortname of your new website here. It will be used to display comment sections under some of your pages or collections. ⚠️ Make sure you disable adertisments in your disqus website settings!
GAME_NAME Full name of the game that the website is about ("Sample Game")
SITE_IMAGE Path of the image in ${PROJECT}/static/img folder ("sample.png"). This image is used as the main illustration of the website, shared on social media. It is recommended to avoid transparency in this image.
SITE_NAME Full name of the website (can be different from SITE in django settings) ("Sample Website")
SITE_STATIC_URL Full URL of the static files (images, javascript, uploaded files), differs in production and development, ends with a / ("//i.sample.com/")
SITE_URL Full URL of the website, ends with a / ("http://sample.com/")

Optional settings:

  • All the settings that have a ⭐️ have their respective values in magi.default_settings prefixed with DEFAULT_ (for example: GROUPS have DEFAULT_GROUPS).
    • It's highly recommended to use these values and extend them instead of overriding them.
    • If they also have a ❗️, it means the site won't work unless the default values are included (extended and not overrided).
Setting About Default value
ABOUT_PHOTO Path of the image in ${PROJECT}/static/img folder "engildeby.gif"
ACCOUNT_TAB _ORDERING List of tabs names in the order you would like them to appear for each profile account tabs. Missing tab names in this list will just appear at the end. None (order not guaranteed)
ACTIVITY_TAGS List of tuples (raw value, full localizable tag name) for the tags that can be added ao an activity ⭐️
BACKGROUNDS List of dict (keys: id, image, name / optional keys: thumbnail, d_names) for each background that can be set as profiles' backgrounds. If the backgrounds are in the database, it's recommended to use GET_BACKGROUNDS instead. None
BIRTHDAY_BANNER _HIDE_TITLE See Characters False
BIRTHDAY_TAG See Characters See Characters
BUG_TRACKER _URL Full URL where people can see issues (doesn't have to be github) Full URL created from the GITHUB_REPOSITORY value
CALL_TO _ACTION A sentence shown on the default index page to encourage visitors to sign up _('Join the community!')
COMMENTS_ENGINE Don't use. Was originally meant to allow using Commento, which turned out to not allow URL names, so it's not compatible with MagiCircles disqus
CONTACT_DISCORD Contact Discord server invite URL "https://discord.gg/mehDTsv"
CONTACT_EMAIL Main contact email address Value in django settings AWS_SES_RETURN_PATH
CONTACT_FACEBOOK Contact Facebook username or page "db0company"
CONTACT_REDDIT Contact reddit username "db0company"
CONTRIBUTE_URL Full URL of the guide (or README) for developers who would like to contribute link
CORNER_POPUP_IMAGE Image used for corner notifications. Example: example None
CORNER_POPUP _IMAGE_OVERFLOW Should the image show up as bigger than the popup (see example in CORNER_POPUP_IMAGE), or within the popup? False
CUSTOM _PREFERENCES _FORM See Custom users preferences and settings
DONATE_IMAGE Path of the image in DONATE_IMAGES_FOLDER. May get overriden via staff configurations, see Allow your staff team to change configurations None
DONATORS_GOAL The goal to display on the homepage and donations page. By default, will use what has been spent the current month. Staff can also configure it within the running site, see Allow your staff team to change configurations None
DONATORS_STATUS _CHOICES List of tuples with key (THANKS, SUPPORTER, LOVER, AMBASSADOR, PRODUCER, DEVOTEE) and value (translated names for each status) "Thanks", "Player", "Super Player", "Extreme Player", "Master Player", "Ultimate Player"
EMAIL_IMAGE Path of the image in ${PROJECT}/static/img folder ("sample.png") that will appear at the beginning of all the emails. value of SITE_IMAGE
EMAIL_IMAGE _PER_LANGUAGE Dict of language code -→ image to display different images for EMAIL_IMAGE depending on which language the user being emailed uses {}
EMPTY_IMAGE Path of the image for empty values in cute form in ${PROJECT}/static/img folder "empty.png"
ENABLED_NAVBAR _LISTS See ⎡Configuring the navbar ⭐️
ENABLED_PAGES See ⎡Single pages ⭐️ ❗️
EXTRA _PREFERENCES See Custom users preferences and settings ⭐️
FAVORITE _CHARACTER _NAME See Characters "Character"
FAVORITE _CHARACTER _TO_URL See Characters lambda _: '#'
FAVORITE _CHARACTERS _FILTER See Characters None
FAVORITE _CHARACTERS See Characters None
FAVORITE_CHARACTERS _MODEL See Characters None
FEEDBACK_FORM URL of a form used to gather feedback from user. When not specified, it will just link to the bug tracker. None
FIRST_COLLECTION Which collection list page should a user be redirected to after creating their account? See also GET_STARTED_VIDEO. When it's not specified, redirects to profile. None
GAME_DESCRIPTION A long description of the game. Used on the about game page. None (just shows game image)
GAME_NAME _PER_LANGUAGE A dict of game names per languages, which allows to internationalize the site {}
GAME_URL A link to the official homepage of the game. Used on the about game page. None (just shows game image)
GET _BACKGROUNDS A function that doesn't take any parameter and returns a list of backgrounds as dicts (see BACKGROUNDS for details). Will be used in generated settings to cache backgrounds. See Use generated settings. None
GET_GLOBAL _CONTEXT Provide your own function to add things to the global context. The function takes a request and returns a context. It must call globalContext in magi.utils globalContext
GET_HOMEPAGE_ARTS Used by generated settings only. See Use generated settings and Background illustrations None
GET_STARTED_VIDEO YouTube video code of a video that will show up at the top of the default collection shown to users right after they create their account. Example: TqL9nSNouhw None
GITHUB_REPOSITORY Tuple (Username, repository) for the sources of this website, used in about page ('MagiCircles', 'MagiCircles')
GLOBAL _OUTSIDE_PERMISSIONS See Roles and permissions ⭐️
GOOD_REPUTATION_THRESHOLD How many points are needed to have what's considered a good reputation? Used for example to allow or not to send private messages. 10
GOOGLE_ANALYTICS Tracking number for Google Analytics 'UA-67529921-1'
GROUPS See Roles and permissions ⭐️
HASHTAGS List of hashtags when sharing on Twitter + used as keywords for the page (without #) []
HELP_WIKI Tuple (Username, repository) for the GitHub wiki pages to display the help pages ('MagiCircles', 'MagiCircles')
HOMEPAGE _ARTS See ⎡Background illustrations
HOMEPAGE _ART_GRADIENT See ⎡Background illustrations
HOMEPAGE _ART_POSITION See ⎡Background illustrations ⭐️
HOMEPAGE _ART_SIDE See ⎡Background illustrations
HOMEPAGE _BACKGROUND See ⎡Background illustrations
HOMEPAGE _BACKGROUNDS See ⎡Background illustrations
HOMEPAGE _RIBBON Shows a ribbon on the homepage or not, bool. See Background illustrations False
HOME_ACTIVITY_TABS Ordered dict of tab names and their details ⭐️
JAVASCRIPT _TRANSLATED _TERMS Terms used in gettext function in Javascript, must contain DEFAULT_JAVASCRIPT _TRANSLATED_TERMS in magi.default_settings ⭐️ ❗️
JAVASCRIPT_COMMONS Boolean. Will load a file called commons.js in your static folder that is expected to contain a function called customLoadCommons. That function will be called at the end of the loadCommons function in Javascript. See Javascript utils ("Commons" section) None
JAVASCRIPT _TRANSLATED_TERMS List of terms (plain strings, not translated) that will be made available in Javascript. More can also be added in context per view or page. In your javascript code, you can then call getText('Your string') to get its translation. ⭐️❗️
LANGUAGES _CANT_SPEAK _ENGLISH While English is prominent in many countries and it's not rare to see English text, it can be surprising and feel out of place to see English content in other countries. To avoid showing English content to users that use a language that makes them likely uneasy with English text, a list of languages can be provided in LANGUAGES _CANT_SPEAK_ENGLISH. For these, content will be hidden when no translations are available, such as for translated fields, wiki and help pages and links to help pages. It's encouraged to check if the current language is in this list whenever displaying content in English in your own views. List of language codes that correspond to the languages that are more likely to be spoken by people who don't speak English. It will be used to hide some things that are untranslated by default, such as wiki/help pages and activities not in their language. This is to ensure that we keep them interested in the site and not scare them off with a language they can't speak. ⭐️ ['ja', 'zh-hans', 'zh-hant', 'kr']
LAUNCH_DATE If you want to tease your community before officially opening the website, or just let your staff team test it, you can set a launch date. It will make all the pages and collections only available to staff and make the homepage a countdown before the website opens. Example: import datetime, pytz datetime.datetime(2017, 04, 9, 12, 0, 0, tzinfo=pytz.UTC) None
MAX_ACTIVITY _HEIGHT Size in pixels of activities in the feed. When an activity is longer, it will be cropped and and show a button that says "More" 1200
MAX_LEVEL _BEFORE _SCREENSHOT_REQUIRED See "Self-service verifications" in BaseAccount model 200
MAX_LEVEL _UP_STEP _BEFORE _SCREENSHOT _REQUIRED See "Self-service verifications" in BaseAccount model 10
MINIMUM_LIKES_POPULAR How many likes are required on an activity to consider it popular? Popular activities get their own filter and tab by default 10
NAVBAR_ORDERING List of collection or page names in the order you would like them to appear in the nav bar. Missing collection or page name in this list will just appear at the end. ⭐️
ONLY_SHOW_SAME _LANGUAGE_ACTIVITY _BY_DEFAULT If set to True, uers will only see the activities in their language (regardless of authentication), otherwise, they'll see all activities in all languages. Note that users can override this behavior in their settings. False
ONLY_SHOW_SAME _LANGUAGE_ACTIVITY _BY_DEFAULT _FOR_LANGUAGES You may use this instead of ONLY_SHOW_SAME_LANGUAGE _ACTIVITY_BY_DEFAULT to specify per language ['ja', 'zh-hans', 'kr']
ON_PREFERENCES _EDITED Callback after a user's preferences have been changed, takes user instance (contains updated user.preferences). If you call this yourself, make sure you also call models.onPreferencesEdited. None
ON_USER_EDITED Callback after a user's username or email has been changed, takes user instance. If you call this yourself, make sure you also call models.onUserEdited. None
OTHER_CHARACTERS_MODELS See Characters {}
PRELAUNCH _ENABLED_PAGES When launch date is set, all the pages in ENABLED_PAGES get changed to only be available to staff members, except the pages listed here. ⭐️ ❗️
PROFILE_BACKGROUNDS See ⎡Background illustrations
PROFILE_TABS Tabs visible in a user's profile page, under the box that contins the avatar, the description and the links. A dictionary with:
  • name: localized tab name
  • icon: String name of a flaticon that illustrates the tab
  • callback: optional, name of javasript function to call to get the content of the tab - takes:
    • user_id
    • A callback that you must call and give it the HTML tree to display for this tab and an optional other callback to call after it's been displayed
⭐️❗️ accounts, activities and badges. Will be disabled if you disable their respective collection.
RANDOM_ART _FOR_CHARACTER See ⎡Background illustrations and Characters
REDIRECT_AFTER_SIGNUP Lambda that takes the user that just signed up and returns a URL to redirect to Redirects to account creation or home
SEASONS See Seasons ⭐️
SECONDARY_COLOR Color used all around the website as a secondary color. See also COLOR and ACCENT_COLOR. Complimentary color generated from COLOR
SHOW _TOTAL_ACCOUNTS On profiles, show or hide the total number of accounts before showing the accounts. Bool, should the number of accounts be displayed? If most of the time, users will only have 1 account, it's recommended to not show the total True
SITE _DESCRIPTION Slogan, catch phrase of the website. May be a callable that doesn't take any argument (lambda: _('Best database for best game')) "The {game name} Database & Community"
SITE_EMOJIS Emojis that represent the site well. Mostly used for buttons to share on Twitter, etc. None
SITE_IMAGE _PER_LANGUAGE A dict of language code → image to display a different SITE_IMAGE depending on which language a user is using. {}
SITE_LOGO Path of the image displayed on the homepage. value of SITE_IMAGE
SITE_LOGO _PER_LANGUAGE The logo displayed on the homepage may need to be different depending on the language. This is a dictionary of language code => path of the image {}
SITE_LOGO_WHEN_LOGGED_IN If you want the logo displayed on the homepage to be different for authenticated users. Usually a shorter version, to make more space for activities. Example: full logologo when logged in Uses SITE_LOGO
SITE_LOGO _WHEN_LOGGED_IN _PER_LANGUAGE A dict of language code → image to display a different SITE_LOGO_WHEN_LOGGED_IN depending on which language a user is using. {}
SITE_LONG _DESCRIPTION A long description of what the website does. Used on the about page. May be a callable that doesn't take any argument A long text
SITE_NAME _PER_LANGUAGE A dict of site names per language, allowing to internationalize the site name {}
SITE_NAV_LOGO Path of the image displayed instead of the website name in the nav bar None
TRANSLATION _HELP_URL URL with guide or tools to allow people to contribute to the website's translation link
TRANSLATION_HELP_URL URL to translators guide '/help/Translators%20guide'
TWITTER_HANDLE Official Twitter account of this website "schoolidolu"
USERS_BIRTHDAYS_BANNER Path to a banner image URL that will show up as a background when celebrating users birthday on the homepage's carousel of latest news. See "Latest news" in Use generated settings None
USERS_REPUTATION_CALCULATOR Users have a reputation score based on their actions on the website. This is a lambda that takes a dictionary (keys are the type of action, values are tuples with how many times the user did the action and how many points gotten per action = multiplier), and returns a modified version of that same dictionary, allowing you to change the multipliers or add your own points. It's called whenever reputation gets recalculated (once a day). None
USER_COLORS List of tuples (raw value, full localizable color name, CSS elements name (btn-xx, panel-xx, ...), hex code of the color) None
WIKI Tuple (Username, repository) for the GitHub wiki pages to display the help pages Value of GITHUB_REPOSITORY

Tools

The following settings are automatically available for you to use, but you can't set them yourself.

Setting About
LAST_SERVER_RESTART datetime of last time the server got restarted, which usually indicated when was the last time generated settings were taken into account. See Use generated settings. In production, because there can be multiple instances of the same site running in order to accommodate users load, this value can differ based on when said instance launched.
STAFF_CONFIGURATIONS Shortcut to django_settings.STAFF_CONFIGURATIONS. See [[Staff configurations
STATIC_FILES_VERSION Shortcut to django_settings.STATIC_FILES_VERSION which is an optional variable you can set in your local settings in production in order to force an update of static files whenever there's an update that changes some of the static files. A number or string that you can change when you update the css or js file of your project to force update the cache of your users in production
STATIC_UPLOADED_FILES_PREFIX Shortcut to django_settings.STATIC_UPLOADED_FILES_PREFIX, the folder where static files get uploaded basically. Usually u/.
LATEST_NEWS Shortcut to django_settings.LATEST_NEWS. See Use generated settings.
TOTAL_DONATORS Total number of donators, generated, see Use generated settings
HOMEPAGE_BACKGROUNDS_IMAGES See Background illustrations
HOMEPAGE_BACKGROUNDS_THUMBNAILS See Background illustrations
HOMEPAGE_BACKGROUNDS_NAMES See Background illustrations
PROFILE_BACKGROUNDS_IMAGES See Background illustrations
PROFILE_BACKGROUNDS_THUMBNAILS See Background illustrations
PROFILE_BACKGROUNDS_NAMES See Background illustrations

I. Introduction

II. Tutorials

  1. Collections
    1. MagiModel
    2. MagiCollection
    3. MagiForm
    4. MagiFiltersForm
    5. MagiFields
  2. Single pages
  3. Configuring the navbar

III. References

IV. Utils

V. Advanced tutorials

VI. More

Clone this wiki locally