
    Gwg;                         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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)RemovedInDjango50WarningRemovedInDjango51Warning)
LazyObjectemptyDJANGO_SETTINGS_MODULEdefaultstaticfileszThe USE_DEPRECATED_PYTZ setting, and support for pytz timezones is deprecated in favor of the stdlib zoneinfo module. Please update your code to use zoneinfo and remove the USE_DEPRECATED_PYTZ setting.zThe USE_L10N setting is deprecated. Starting with Django 5.0, localized formatting of data will always be enabled. For example Django will display numbers and dates using the format of the current locale.zhThe CSRF_COOKIE_MASKED transitional setting is deprecated. Support for it will be removed in Django 5.0.zEThe DEFAULT_FILE_STORAGE setting is deprecated. Use STORAGES instead.zDThe STATICFILES_STORAGE setting is deprecated. Use STORAGES instead.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      K/var/www/horilla/myenv/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__>   s
    (r   N)__name__
__module____qualname____doc__r   r    r   r   r   r   5   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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._setupI   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__[   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__c   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__t   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__   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.configure   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USE_L10N)rg   USE_L10N_DEPRECATED_MSGr   r:   r0   s    r   rj   zLazySettings.USE_L10N   s)    &&#%=	
 
++r   c                 $    | j                  d      S ri   )r:   r0   s    r   _USE_L10N_INTERNALzLazySettings._USE_L10N_INTERNAL   s     
++r   c                 X    | j                  t        t               | j                  d      S )NDEFAULT_FILE_STORAGE)rg   #DEFAULT_FILE_STORAGE_DEPRECATED_MSGr   r:   r0   s    r   ro   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   rr   z LazySettings.STATICFILES_STORAGE   s*    &&.0H	
  566r   r   )r   r   r   r   r-   r1   r:   r?   rB   r   rN   staticmethodr7   propertyrU   rg   rj   rm   ro   rr   __classcell__r@   s   @r   r!   r!   B   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u r,| j!                  d      st#        j$                  dt&               | j!                  d      rt#        j$                  t(        t&               | j!                  d      rt#        j$                  t*        t&               t-        t.        d	      r| j0                  rt3        d
      } |j4                  | j0                  j7                  d       }|j9                         r(|j9                         st;        d| j0                  z        | j0                  t<        j>                  d<   t/        j@                          | j!                  d      rt#        j$                  tB        t&               | j!                  d      ra| j!                  d      rt        d      i | jD                  tF        d| jH                  ii| _"        t#        j$                  tJ        tL               | j!                  d      ra| j!                  d      rt        d      i | jD                  tN        d| jP                  ii| _"        t#        j$                  tR        tL               | j!                  d      rut        | d| jD                  jU                  tF        i       jU                  d             t        | d| jD                  jU                  tN        i       jU                  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.FUSE_TZzThe default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior.)rc   USE_DEPRECATED_PYTZCSRF_COOKIE_MASKEDtzsetz/usr/share/zoneinforP   zIncorrect timezone setting: %sTZrj   ro   STORAGESz5DEFAULT_FILE_STORAGE/STORAGES are mutually exclusive.BACKENDrr   z4STATICFILES_STORAGE/STORAGES are mutually exclusive.)+dirr   rH   rJ   r6   r/   	importlibimport_moduleset_explicit_settings
isinstancelisttupler   addr   is_overriddenr`   ra   r   "USE_DEPRECATED_PYTZ_DEPRECATED_MSG!CSRF_COOKIE_MASKED_DEPRECATED_MSGhasattrtime	TIME_ZONEr   joinpathsplitexists
ValueErrorr$   r%   r   rk   r   DEFAULT_STORAGE_ALIASro   rp   r   STATICFILES_STORAGE_ALIASrr   rs   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 ;;%(:(:8(DMMD 2	 34MM<>VW23MM;=UV4!dnn !!67M3]33T^^5I5I#5NON##%n.C.C.E !ADNN!RSS  $~~BJJtJJLj)MM13KL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__2  s*    0>>**#334
 
 	
r   N)r   r   r   r   r   r1   r   r   r   r(   r(      s    ]~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__H  s/    ||~!6  t,,d33r   c                    | j                   j                  |       |dk(  rt        j                  t        t
               |dk(  rt        j                  t        t
               |dk(  r=d| j                  i| j                  t        <   t        j                  t        t               |dk(  r=d| j                  i| j                  t        <   t        j                  t        t               t        | A  ||       |dk(  rt        j                  t"        t
               |dk(  r| j                  j%                  t              x}r t        | A  d|j%                  d             n"| j                  j'                  t        ddi       | j                  j%                  t              x}r t        | A  d|j%                  d             y | j                  j'                  t        dd	i       y y )
Nrj   r   ro   r   rr   r   r   z+django.core.files.storage.FileSystemStoragez5django.contrib.staticfiles.storage.StaticFilesStorage)r   discardr`   ra   rk   r   r   ro   r   r   rp   r   rr   r   rs   r>   r?   r   r&   
setdefault)r   r*   r   default_file_storagestaticfiles_storager@   s        r   r?   zUserSettingsHolder.__setattr__M  s   d#:MM13KL''MM;=UV))4444DMM/0 MM=?WX((4338DMM34 MM<>VWD%(((MM<>VW:'+}}'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__y  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>  s%      
% 
s   )sortedr8   r   rK   r0   s   `r   __dir__zUserSettingsHolder.__dir__~  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>  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__  s#    4>>**
 
 	
r   )r   r   r   r   r/   r   r:   r?   rB   r   r   r1   rv   rw   s   @r   rF   rF   9  s1    . O14
*X&

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   r   rk   r   rp   rs   r   r   r!   r(   rF   r#   r   r   r   <module>r      s     	      ' 7 W 5/ ! ) G #H ( " L $
 K #

) 
)J7: J7Zg
 g
TW
 W
t >r   