• 1403/07/15

خطای config :

درود بر شما 

من وقت داخل console می خوام کد نویسی رو شروع کنم همچین خطایی دریافت می کنم  با وجود اینکه تمام مراحل زیر رو رفتم 

Set the DJANGO_SETTINGS_MODULE Environment Variable: Ensure that the DJANGO_SETTINGS_MODULE environment variable is set to your settings module. You can do this in your terminal or within your IDE. For example:
export DJANGO_SETTINGS_MODULE=your_project_name.settings

Check Your manage.py and wsgi.py Files: Make sure that these files have the correct settings module specified. They should include something like:
Python

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project_name.settings')
AI-generated code. Review and use carefully. More info on FAQ.
Configure Logging in settings.py: Ensure that your logging configuration is correctly set up in your settings.py file. Here is an example of a basic logging configuration:
Python

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console'],
        'level': 'DEBUG',
    },
}
AI-generated code. Review and use carefully. More info on FAQ.
Avoid Logging Calls in settings.py: Avoid placing logging calls directly in settings.py as logging might not be set up at that point12.
خطا : 
Traceback (most recent call last):
  File "<input>", line 6, in <module>
  File "C:\Users\Mahan\PycharmProjects\eshap_project\.venv\Lib\site-packages\django\__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Mahan\PycharmProjects\eshap_project\.venv\Lib\site-packages\django\conf\__init__.py", line 81, in __getattr__
    self._setup(name)
  File "C:\Users\Mahan\PycharmProjects\eshap_project\.venv\Lib\site-packages\django\conf\__init__.py", line 61, in _setup
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
  • 1403/07/16
  • ساعت 11:11

سلام خدمت شما دانشجوی گرامی

متوجه نمیشم منظورتون رو

ینی چی میخواین توی کنسول کد بزنین؟

پروژه جنگو نیست؟


  • 1403/07/17
  • ساعت 01:19

درود بر شما ، مشکل رفع شد ، منون از وقتی که گذاشتید 


  • 1403/07/18
  • ساعت 09:05

سلامت باشید

خوشحالم برطرف شد


logo-samandehi