Browse Source

Avatar cache added to project template

Rafał Pitoń 11 years ago
parent
commit
f0aa8ff0ba

+ 12 - 0
docs/developers/settings.rst

@@ -178,6 +178,18 @@ MISAGO_ADMIN_SESSION_EXPIRATION
 Maximum allowed lenght of inactivity period between two requests to admin namespaces. If its exceeded, user will be asked to sign in again to admin backed before being allowed to continue activities.
 
 
+MISAGO_AVATARS_SIZES
+--------------------
+
+Misago uses avatar cache that prescales avatars to requested sizes. Enter here sizes to which those should be optimized.
+
+
+MISAGO_INITIALS_AVATAR_FUNCTION
+-------------------------------
+
+Function used to create initials avatar for this user. Allows for customization of algorithm used to generate those.
+
+
 MISAGO_MAILER_BATCH_SIZE
 ------------------------
 

+ 7 - 0
misago/conf/defaults.py

@@ -222,6 +222,13 @@ MISAGO_ADMIN_NAMESPACES = (
 MISAGO_ADMIN_SESSION_EXPIRATION = 60
 
 
+# Function used for generating individual avatar for user
+MISAGO_INITIALS_AVATAR_FUNCTION = 'misago.users.avatars.initials.set_user_avatar'
+
+# For which sizes avatars should be cached?
+MISAGO_AVATARS_SIZES = (150, 100, 64, 50, 30, 20)
+
+
 # Default forms templates
 CRISPY_TEMPLATE_PACK = 'bootstrap3'
 

+ 2 - 0
misago/project_template/attachments/README.txt

@@ -1 +1,3 @@
 This directory is used by Misago to store uploaded posts attachments.
+
+Make sure its not accessible from outside!

+ 3 - 0
misago/project_template/avatar_cache/README.txt

@@ -0,0 +1,3 @@
+This directory is used by Misago avatar server to cache final user avatars.
+
+Make sure its not accessible from outside!

+ 1 - 0
misago/project_template/media/avatars/index.html

@@ -0,0 +1 @@
+index.html

+ 3 - 2
misago/project_template/project_name/settings.py

@@ -67,9 +67,10 @@ MEDIA_URL = '/media/'
 
 
 # Automatically setup default paths to media and attachments directories
-STATIC_ROOT = os.path.join(BASE_DIR, 'static')
-MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
 ATTACHMENTS_ROOT = os.path.join(BASE_DIR, 'attachments')
+AVATAR_CACHE = os.path.join(BASE_DIR, 'avatar_cache')
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+STATIC_ROOT = os.path.join(BASE_DIR, 'static')
 
 
 # Automatically setup default paths for static and template directories