
    /~h4                         d Z ddlZddlZddlZddlZddlZddlmZ ddlZddl	m
Z
 ddlmZ ddlmZmZ ddlmZmZ dZd	Zd
ZdZdZdZ G d de      Z G d de      Z G d d      Z G d d      Z e       Zy)z
Settings and configuration for Django.

Read values from the module specified by the DJANGO_SETTINGS_MODULE environment
variable, and then from django.conf.global_settings; see the global_settings.py
for a list of all possible variables.
    N)Path)global_settings)ImproperlyConfigured)RemovedInDjango51WarningRemovedInDjango60Warning)
LazyObjectemptyDJANGO_SETTINGS_MODULEdefaultstaticfileszEThe DEFAULT_FILE_STORAGE setting is deprecated. Use STORAGES instead.zDThe STATICFILES_STORAGE setting is deprecated. Use STORAGES instead.zCThe FORMS_URLFIELD_ASSUME_HTTPS transitional setting is deprecated.c                       e Zd ZdZd Zd Zy)SettingsReferencez
    String subclass which references a current settings value. It's treated as
    the value in memory but serializes to a settings.NAME attribute reference.
    c                 .    t         j                  | |      S N)str__new__selfvaluesetting_names      ]/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/django/conf/__init__.pyr   zSettingsReference.__new__.   s    {{4''    c                     || _         y r   )r   r   s      r   __init__zSettingsReference.__init__1   s
    (r   N)__name__
__module____qualname____doc__r   r    r   r   r   r   (   s    
()r   r   c                        e Zd ZdZddZd Zd Z fdZ fdZe	fdZ
ed        Zed	        Zd
 Zed        Zed        Z xZS )LazySettingsz
    A lazy proxy for either global Django settings or a custom settings object.
    The user can manually configure settings prior to using them. Otherwise,
    Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE.
    c                     t         j                  j                  t              }|s|rd|z  nd}t	        d|dt        d      t        |      | _        y)z
        Load the settings module pointed to by the environment variable. This
        is used the first time settings are needed, if the user hasn't
        configured settings manually.
        z
setting %ssettingsz
Requested zS, but settings are not configured. You must either define the environment variable z8 or call settings.configure() before accessing settings.N)osenvirongetENVIRONMENT_VARIABLEr   Settings_wrapped)r   namesettings_moduledescs       r   _setupzLazySettings._setup<   sP     **..)=>,0L4'jD& -/  !1r   c                 ^    | j                   t        u rydd| j                   j                  iz  S )Nz<LazySettings [Unevaluated]>z$<LazySettings "%(settings_module)s">r+   )r)   r	   SETTINGS_MODULEr   s    r   __repr__zLazySettings.__repr__N   s2    ==E!15t}}<<9
 
 	
r   c                     | j                   x}t        u r| j                  |       | j                   }t        ||      }|dv r|| j	                  |      }n|dk(  r|st        d      || j                  |<   |S )z<Return the value of a setting and cache it in self.__dict__.>   	MEDIA_URL
STATIC_URL
SECRET_KEYz)The SECRET_KEY setting must not be empty.)r)   r	   r-   getattr_add_script_prefixr   __dict__)r   r*   r)   vals       r   __getattr__zLazySettings.__getattr__V   s|    %H%/KK}}Hh% ..3?))#.C\!#&'RSS!d
r   c                     |dk(  r| j                   j                          n| j                   j                  |d       t        |   ||       y)z
        Set the value of setting. Clear all cached values if _wrapped changes
        (@override_settings does this) or clear single values when set.
        r)   N)r8   clearpopsuper__setattr__)r   r*   r   	__class__s      r   r?   zLazySettings.__setattr__g   s@    
 :MM!MMdD)D%(r   c                 \    t         |   |       | j                  j                  |d       y)z3Delete a setting and clear it from cache if needed.N)r>   __delattr__r8   r=   r   r*   r@   s     r   rB   zLazySettings.__delattr__r   s$    D!$%r   c                     | j                   t        urt        d      t        |      }|j	                         D ]0  \  }}|j                         st        d|z        t        |||       2 || _         y)z
        Called to manually configure the settings. The 'default_settings'
        parameter sets where to retrieve any unspecified values from (its
        argument must support attribute access (__getattr__)).
        zSettings already configured.zSetting %r must be uppercase.N)r)   r	   RuntimeErrorUserSettingsHolderitemsisupper	TypeErrorsetattr)r   default_settingsoptionsholderr*   r   s         r   	configurezLazySettings.configurew   so     ==%=>>#$45"==? 	)KD%<<> ?$ FGGFD%(	) r   c                 J    | j                  d      r| S ddlm}  |       | S )z
        Add SCRIPT_NAME prefix to relative paths.

        Useful when the app is being served at a subpath and manually prefixing
        subpath to STATIC_URL and MEDIA_URL in settings is inconvenient.
        )zhttp://zhttps:///r   )get_script_prefix)
startswithdjango.urlsrQ   )r   rQ   s     r   r7   zLazySettings._add_script_prefix   s)     89L1*,e44r   c                 &    | j                   t        uS )z9Return True if the settings have already been configured.)r)   r	   r0   s    r   
configuredzLazySettings.configured   s     }}E))r   c                     t        j                         }|d   \  }}}}|j                  t        j                  j                  t        j                              st        j                  ||d       y y )N   )
stacklevel)
	tracebackextract_stackrR   r$   pathdirnamedjango__file__warningswarn)r   messagecategorystackfilename_s         r   _show_deprecation_warningz&LazySettings._show_deprecation_warning   sY    '') ""I!Q""277??6??#CDMM'8: Er   c                 X    | j                  t        t               | j                  d      S )NDEFAULT_FILE_STORAGE)rg   #DEFAULT_FILE_STORAGE_DEPRECATED_MSGr   r:   r0   s    r   ri   z!LazySettings.DEFAULT_FILE_STORAGE   s*    &&/1I	
  677r   c                 X    | j                  t        t               | j                  d      S )NSTATICFILES_STORAGE)rg   "STATICFILES_STORAGE_DEPRECATED_MSGr   r:   r0   s    r   rl   z LazySettings.STATICFILES_STORAGE   s*    &&.0H	
  566r   r   )r   r   r   r   r-   r1   r:   r?   rB   r   rN   staticmethodr7   propertyrU   rg   ri   rl   __classcell__r@   s   @r   r!   r!   5   s    2$
"	)&
 *9  5 5 * *; 8 8 7 7r   r!   c                       e Zd Zd Zd Zd Zy)r(   c           	         t        t              D ].  }|j                         st        | |t	        t        |             0 || _        t        j                  | j
                        }d}t               | _	        t        |      D ]o  }|j                         st	        ||      }||v r$t        |t        t        f      st        d|z        t        | ||       | j                  j                  |       q | j                  d      rt!        j"                  t$        t&               t)        t*        d      r| j,                  rt/        d      } |j0                  | j,                  j3                  d       }|j5                         r(|j5                         st7        d| j,                  z        | j,                  t8        j:                  d<   t+        j<                          | j                  d	      ra| j                  d
      rt        d      i | j>                  t@        d| jB                  ii| _        t!        j"                  tD        tF               | j                  d      ra| j                  d
      rt        d      i | j>                  tH        d| jJ                  ii| _        t!        j"                  tL        tF               | j                  d
      rut        | d	| j>                  jO                  t@        i       jO                  d             t        | d| j>                  jO                  tH        i       jO                  d             y y )N)ALLOWED_HOSTSINSTALLED_APPSTEMPLATE_DIRSLOCALE_PATHSSECRET_KEY_FALLBACKSz)The %s setting must be a list or a tuple.FORMS_URLFIELD_ASSUME_HTTPStzsetz/usr/share/zoneinforP   zIncorrect timezone setting: %sTZri   STORAGESz5DEFAULT_FILE_STORAGE/STORAGES are mutually exclusive.BACKENDrl   z4STATICFILES_STORAGE/STORAGES are mutually exclusive.)(dirr   rH   rJ   r6   r/   	importlibimport_moduleset_explicit_settings
isinstancelisttupler   addis_overriddenr`   ra   *FORMS_URLFIELD_ASSUME_HTTPS_DEPRECATED_MSGr   hasattrtime	TIME_ZONEr   joinpathsplitexists
ValueErrorr$   r%   rz   r|   DEFAULT_STORAGE_ALIASri   rj   r   STATICFILES_STORAGE_ALIASrl   rm   r&   )r   r+   settingmodtuple_settingssetting_valuezoneinfo_rootzone_info_files           r   r   zSettings.__init__   s   ?+ 	JG gw'HI	J
  /%%d&:&:;
 #&%3x 	5G  'W 5n,Z!D%=6 /CgM  g}5''++G4	5 ;<MM:(
 4!dnn !!67M3]33T^^5I5I#5NON##%n.C.C.E !ADNN!RSS  $~~BJJtJJL45!!*-*K --%	43L3L'MDM MM=?WX34!!*-*J --)It7O7O+PDM MM<>VWj)&!!"7<@@K
 %!!";R@DDYO *r   c                     || j                   v S r   )r   )r   r   s     r   r   zSettings.is_overridden	  s    $1111r   c                 N    d| j                   j                  | j                  dz  S )Nz<%(cls)s "%(settings_module)s">)clsr+   )r@   r   r/   r0   s    r   r1   zSettings.__repr__  s*    0>>**#334
 
 	
r   N)r   r   r   r   r   r1   r   r   r   r(   r(      s    Rh2
r   r(   c                   N     e Zd ZdZdZd Zd Z fdZ fdZd Z	d Z
d	 Z xZS )
rF   z$Holder for user configured settings.Nc                 @    t               | j                  d<   || _        y)z
        Requests for configuration variables not in this class are satisfied
        from the module specified in default_settings (if possible).
        _deletedN)r   r8   rK   )r   rK   s     r   r   zUserSettingsHolder.__init__  s    
 %(Ej! 0r   c                 v    |j                         r|| j                  v rt        t        | j                  |      S r   )rH   r   AttributeErrorr6   rK   )r   r*   s     r   r:   zUserSettingsHolder.__getattr__"  s/    ||~!6  t,,d33r   c                 B   | j                   j                  |       |dk(  r=d| j                  i| j                  t        <   t        j                  t        t               |dk(  r=d| j                  i| j                  t        <   t        j                  t        t               |dk(  rt        j                  t        t               t        | =  ||       |dk(  r| j                  j!                  t              x}r t        | =  d|j!                  d             n"| j                  j#                  t        ddi       | j                  j!                  t              x}r t        | =  d|j!                  d             y | j                  j#                  t        ddi       y y )Nri   r}   rl   ry   r|   z+django.core.files.storage.FileSystemStoragez5django.contrib.staticfiles.storage.StaticFilesStorage)r   discardri   r|   r   r`   ra   rj   r   rl   r   rm   r   r   r>   r?   r&   
setdefault)r   r*   r   default_file_storagestaticfiles_storager@   s        r   r?   zUserSettingsHolder.__setattr__'  st   d#))4444DMM/0 MM=?WX((4338DMM34 MM<>VW00MM:( 	D%(:'+}}'8'89N'OO#O#*,@,D,DY,O (() MN '+mm&7&78Q&RR"R#)+>+B+B9+M ((-!S r   c                 t    | j                   j                  |       t        | |      rt        |   |       y y r   )r   r   r   r>   rB   rC   s     r   rB   zUserSettingsHolder.__delattr__R  s1    $4G% r   c                 n     t         fdg  j                  t         j                        D              S )Nc              3   >   K   | ]  }|j                   vr|  y wr   )r   ).0sr   s     r   	<genexpr>z-UserSettingsHolder.__dir__.<locals>.<genexpr>X  s%      
% 
s   )sortedr8   r~   rK   r0   s   `r   __dir__zUserSettingsHolder.__dir__W  s6     
Bt}}Bs4+@+@'AB
 
 	
r   c                     || j                   v }|| j                  v } t        | j                  dd       |      }|xs |xs |S )Nr   c                      y)NFr   )r   s    r   <lambda>z2UserSettingsHolder.is_overridden.<locals>.<lambda>b  s    r   )r   r8   r6   rK   )r   r   deletedset_locallyset_on_defaults        r   r   z UserSettingsHolder.is_overridden^  sS    T]]*.
!!?O

 7+77r   c                 8    dd| j                   j                  iz  S )Nz	<%(cls)s>r   )r@   r   r0   s    r   r1   zUserSettingsHolder.__repr__f  s#    4>>**
 
 	
r   )r   r   r   r   r/   r   r:   r?   rB   r   r   r1   rp   rq   s   @r   rF   rF     s1    . O14
)V&

8
r   rF   )r   r   r$   r   rZ   r`   pathlibr   r^   django.confr   django.core.exceptionsr   django.utils.deprecationr   r   django.utils.functionalr   r	   r'   r   r   rj   rm   r   r   r   r!   r(   rF   r#   r   r   r   <module>r      s     	      ' 7 W 5/ ! )  L $
 K # J +

) 
)|7: |7~\
 \
~V
 V
r >r   