o
    ÔèFhÐ4  ã                   @   sÖ   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„ deƒZG dd„ deƒZG dd„ dƒZG dd„ dƒZeƒ ZdS )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                   @   s    e Zd ZdZdd„ Zdd„ ZdS )Ú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                 C   s   t  | |¡S ©N)ÚstrÚ__new__©ÚselfÚvalueÚsetting_name© r   úM/var/www/html/loop/nvenv/lib/python3.10/site-packages/django/conf/__init__.pyr   .   s   zSettingsReference.__new__c                 C   s
   || _ d S r   )r   r   r   r   r   Ú__init__1   ó   
zSettingsReference.__init__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   (   s    r   c                       sŠ   e Zd ZdZddd„Zdd„ Zdd„ Z‡ fd	d
„Z‡ fdd„Ze	fdd„Z
edd„ ƒZedd„ ƒZdd„ Zedd„ ƒZedd„ ƒZ‡  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.
    Nc                 C   s>   t j t¡}|s|rd| nd}td|tf ƒ‚t|ƒ| _dS )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 %s, but settings are not configured. You must either define the environment variable %s or call settings.configure() before accessing settings.N)ÚosÚenvironÚgetÚENVIRONMENT_VARIABLEr   ÚSettingsÚ_wrapped)r   ÚnameÚsettings_moduleÚdescr   r   r   Ú_setup<   s   ýÿzLazySettings._setupc                 C   s   | j tu rdS dd| j ji S )Nz<LazySettings [Unevaluated]>z$<LazySettings "%(settings_module)s">r%   )r#   r   ÚSETTINGS_MODULE©r   r   r   r   Ú__repr__N   s
   
ÿzLazySettings.__repr__c                 C   sf   | j  }tu r|  |¡ | j }t||ƒ}|dv r"|dur"|  |¡}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_URLNÚ
SECRET_KEYz)The SECRET_KEY setting must not be empty.)r#   r   r'   ÚgetattrÚ_add_script_prefixr   Ú__dict__)r   r$   r#   Úvalr   r   r   Ú__getattr__V   s   


zLazySettings.__getattr__c                    s4   |dkr
| j  ¡  n| j  |d¡ tƒ  ||¡ dS )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)r0   ÚclearÚpopÚsuperÚ__setattr__)r   r$   r   ©Ú	__class__r   r   r6   g   s   zLazySettings.__setattr__c                    s   t ƒ  |¡ | j |d¡ dS )z3Delete a setting and clear it from cache if needed.N)r5   Ú__delattr__r0   r4   ©r   r$   r7   r   r   r9   r   s   zLazySettings.__delattr__c                 K   sV   | j tur	tdƒ‚t|ƒ}| ¡ D ]\}}| ¡ std| ƒ‚t|||ƒ q|| _ dS )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   r   r   r   Ú	configurew   s   

zLazySettings.configurec                 C   s(   |   d¡r| S ddlm} d|ƒ | f 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_prefixz%s%s)Ú
startswithÚdjango.urlsrF   )r   rF   r   r   r   r/   †   s   
	zLazySettings._add_script_prefixc                 C   s
   | j tuS )z9Return True if the settings have already been configured.)r#   r   r)   r   r   r   Ú
configured•   s   
zLazySettings.configuredc                 C   sD   t  ¡ }|d \}}}}| tj tj¡¡s tj	||dd� d S d S )Néüÿÿÿé   )Ú
stacklevel)
Ú	tracebackÚextract_stackrG   r   ÚpathÚdirnameÚdjangoÚ__file__ÚwarningsÚwarn)r   ÚmessageÚcategoryÚstackÚfilenameÚ_r   r   r   Ú_show_deprecation_warningš   s
   ÿz&LazySettings._show_deprecation_warningc                 C   ó   |   tt¡ |  d¡S )NÚDEFAULT_FILE_STORAGE)rZ   Ú#DEFAULT_FILE_STORAGE_DEPRECATED_MSGr   r2   r)   r   r   r   r\   ¤   ó   ÿ
z!LazySettings.DEFAULT_FILE_STORAGEc                 C   r[   )NÚSTATICFILES_STORAGE)rZ   Ú"STATICFILES_STORAGE_DEPRECATED_MSGr   r2   r)   r   r   r   r_   ¬   r^   z LazySettings.STATICFILES_STORAGEr   )r   r   r   r   r'   r*   r2   r6   r9   r   rD   Ústaticmethodr/   ÚpropertyrI   rZ   r\   r_   Ú__classcell__r   r   r7   r   r   5   s"    




r   c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )r"   c                 C   sà  t tƒD ]}| ¡ rt| |tt|ƒƒ q|| _t | j¡}d}tƒ | _	t |ƒD ](}| ¡ rOt||ƒ}||v rCt
|ttfƒsCtd| ƒ‚t| ||ƒ | j	 |¡ q'|  d¡r[t tt¡ ttdƒr‰| jr‰tdƒ}|j| j d¡Ž }| ¡ r| ¡ std| j ƒ‚| jtjd< t ¡  |  d	¡rª|  d
¡r—tdƒ‚i | j¥t d| j!ii¥| _t t"t#¡ |  d¡rË|  d
¡r¸tdƒ‚i | j¥t$d| j%ii¥| _t t&t#¡ |  d
¡rît| d	| j 't i ¡ 'd¡ƒ t| d| j 't$i ¡ 'd¡ƒ d S d S )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/zoneinforE   zIncorrect timezone setting: %sÚTZr\   ÚSTORAGESz5DEFAULT_FILE_STORAGE/STORAGES are mutually exclusive.ÚBACKENDr_   z4STATICFILES_STORAGE/STORAGES are mutually exclusive.)(Údirr   r>   r@   r.   r(   Ú	importlibÚimport_moduleÚsetÚ_explicit_settingsÚ
isinstanceÚlistÚtupler   ÚaddÚis_overriddenrS   rT   Ú*FORMS_URLFIELD_ASSUME_HTTPS_DEPRECATED_MSGr   ÚhasattrÚtimeÚ	TIME_ZONEr   ÚjoinpathÚsplitÚexistsÚ
ValueErrorr   r   rj   rl   ÚDEFAULT_STORAGE_ALIASr\   r]   r   ÚSTATICFILES_STORAGE_ALIASr_   r`   r    )r   r%   ÚsettingÚmodÚtuple_settingsÚsetting_valueÚzoneinfo_rootÚzone_info_filer   r   r   r   µ   s„   €

ÿÿ€
þ

ÿÿ
þ

ÿÿ
þ
ýýúzSettings.__init__c                 C   s
   || j v S r   )rr   )r   r‚   r   r   r   rw   	  r   zSettings.is_overriddenc                 C   s   d| j j| jdœ S )Nz<%(cls)s "%(settings_module)s">)Úclsr%   )r8   r   r(   r)   r   r   r   r*     s   þzSettings.__repr__N)r   r   r   r   rw   r*   r   r   r   r   r"   ´   s    Tr"   c                       sX   e Zd ZdZdZdd„ Zdd„ Z‡ fdd„Z‡ fd	d
„Zdd„ Z	dd„ Z
dd„ Z‡  ZS )r<   z$Holder for user configured settings.Nc                 C   s   t ƒ | jd< || _dS )z›
        Requests for configuration variables not in this class are satisfied
        from the module specified in default_settings (if possible).
        Ú_deletedN)rq   r0   rA   )r   rA   r   r   r   r     s   
zUserSettingsHolder.__init__c                 C   s"   |  ¡ r	|| jv rt‚t| j|ƒS r   )r>   r‰   ÚAttributeErrorr.   rA   r:   r   r   r   r2   "  s   zUserSettingsHolder.__getattr__c                    sø   | j  |¡ |dkrd| ji| jt< t tt¡ |dkr*d| j	i| jt
< t tt¡ |dkr4t tt¡ tƒ  ||¡ |dkrz| j t¡ }rRtƒ  d| d¡¡ n	| j tddi¡ | j t
¡ }rotƒ  d| d¡¡ d S | j t
ddi¡ d S d S )Nr\   rm   r_   ri   rl   z+django.core.files.storage.FileSystemStoragez5django.contrib.staticfiles.storage.StaticFilesStorage)r‰   Údiscardr\   rl   r€   rS   rT   r]   r   r_   r�   r`   rx   r   r5   r6   r    Ú
setdefault)r   r$   r   Údefault_file_storageÚstaticfiles_storager7   r   r   r6   '  sF   
ÿ
ÿþ
ÿþ
ÿþþñzUserSettingsHolder.__setattr__c                    s*   | j  |¡ t| |ƒrtƒ  |¡ d S d S r   )r‰   rv   ry   r5   r9   r:   r7   r   r   r9   R  s   
ÿzUserSettingsHolder.__delattr__c                    s&   t ‡ fdd„g ˆ j¢tˆ jƒ¢D ƒƒS )Nc                 3   s   � | ]
}|ˆ j vr|V  qd S r   )r‰   )Ú.0Úsr)   r   r   Ú	<genexpr>X  s   € 
þýz-UserSettingsHolder.__dir__.<locals>.<genexpr>)Úsortedr0   rn   rA   r)   r   r)   r   Ú__dir__W  s   þzUserSettingsHolder.__dir__c                 C   s6   || j v }|| jv }t| jddd„ ƒ|ƒ}|p|p|S )Nrw   c                 S   s   dS )NFr   )r�   r   r   r   Ú<lambda>b  s    z2UserSettingsHolder.is_overridden.<locals>.<lambda>)r‰   r0   r.   rA   )r   r‚   ÚdeletedÚset_locallyÚset_on_defaultr   r   r   rw   ^  s   

ÿþz UserSettingsHolder.is_overriddenc                 C   s   dd| j ji S )Nz	<%(cls)s>rˆ   )r8   r   r)   r   r   r   r*   f  s   ÿzUserSettingsHolder.__repr__)r   r   r   r   r(   r   r2   r6   r9   r“   rw   r*   rc   r   r   r7   r   r<     s    +r<   )r   ro   r   rz   rM   rS   Úpathlibr   rQ   Údjango.confr   Údjango.core.exceptionsr   Údjango.utils.deprecationr   r   Údjango.utils.functionalr   r   r!   r€   r�   r]   r`   rx   r   r   r   r"   r<   r   r   r   r   r   Ú<module>   s4    ÿÿÿ_
Y