Module4 task3 while running views.py

  1. Describe the issue briefly
    while executing views.py i am getting this error
    Traceback (most recent call last):
    File “urls.py”, line 2, in
    from views import GetRestaurants,MenuApiView,OrderListView,GetTags, GetSocial, GetCart, ShareReview
    File “/home/crio-user/workspace/tejasaichowdary02-ME_QEATS_REVIEW_MP/restaurants/views.py”, line 3, in
    from rest_framework.views import APIView
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/views.py”, line 19, in
    from rest_framework.schemas import DefaultSchema
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/schemas/init.py”, line 32, in
    authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/settings.py”, line 220, in getattr
    val = self.user_settings[attr]
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/settings.py”, line 211, in user_settings
    self._user_settings = getattr(settings, ‘REST_FRAMEWORK’, {})
    File “/home/crio-user/.local/lib/python3.6/site-packages/django/conf/init.py”, line 79, in getattr
    self._setup(name)
    File “/home/crio-user/.local/lib/python3.6/site-packages/django/conf/init.py”, line 64, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
    django.core.exceptions.ImproperlyConfigured: Requested setting REST_FRAMEWORK, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.aceback (most recent call last):
    File “urls.py”, line 2, in
    from views import GetRestaurants,MenuApiView,OrderListView,GetTags, GetSocial, GetCart, ShareReview
    File “/home/crio-user/workspace/tejasaichowdary02-ME_QEATS_REVIEW_MP/restaurants/views.py”, line 3, in
    from rest_framework.views import APIView
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/views.py”, line 19, in
    from rest_framework.schemas import DefaultSchema
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/schemas/init.py”, line 32, in
    authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/settings.py”, line 220, in getattr
    val = self.user_settings[attr]
    File “/home/crio-user/.local/lib/python3.6/site-packages/rest_framework/settings.py”, line 211, in user_settings
    self._user_settings = getattr(settings, ‘REST_FRAMEWORK’, {})
    File “/home/crio-user/.local/lib/python3.6/site-packages/django/conf/init.py”, line 79, in getattr
    self._setup(name)
    File “/home/crio-user/.local/lib/python3.6/site-packages/django/conf/init.py”, line 64, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
    django.core.exceptions.ImproperlyConfigured: Requested setting REST_FRAMEWORK, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
  2. How much time have you spent debugging this issue?
    (Please spend at least 15 minutes to resolve the issue on your own before posting a new topic here)
    i have spent more than 2 hr still not getting where i have done wrong
  3. What is your hypothesis?

please anyone tell me what’s wrong with my code

atleast tell me how i can get module4 starting code
i tried to pull but it saying you are already uptodate

Hello Teja, sorry for the delayed response. This might be happening because of the wrong call to the get_tags_suggestions function. Can you check if you are passing all the required arguments while calling the function. See what are the parameters present in the function and call it from your view.py accordingly.

i have passed all the parameters in the function. can you please just look into code and tell me whats wrong with my code

Have you gone through your code? Please compare your get_tags_suggestions() in your clarifai_tag_suggestions.py and view.py. See what are the parameters present in clarifai_tag_suggestions.py. Take your time to solve the problem. We can only give hints and directions.

sory to bother you but i am kind of stuck here i am passing both api_key and image_url to get_tags_suggestions() method still getting the same above mentioned error

have you imported clarifai_tag_suggestions properly before using a method from that file?

1 Like

it seems like you have edited and importing from views it has to be ‘.views’ (in urls.py file).Make all the changes and push again. If your code is proper it should run successfully now. try it.

thankyou for your help @Amogha_Crio_TA

1 Like