django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Tushar Khairnar
C:\Python\python.exe "D:/Python/django reset framework/secondtestdjrstapi/users/views.py"
Traceback (most recent call last):
  File "D:/Python/django reset framework/secondtestdjrstapi/users/views.py", line 2, in <module>
    from rest_framework.authtoken.models import Token
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 11, in <module>
    class Token(models.Model):
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 17, in Token
    settings.AUTH_USER_MODEL, related_name='auth_token',
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 57, in __getattr__
    self._setup(name)
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 42, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/36636e92-854d-4a77-9493-b60836799509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

debug_err.png (43K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Ryan Nowakowski
I'm not quite sure what you're trying to do. Are you trying to run views.py?

On December 5, 2018 6:21:06 AM CST, Tushar Khairnar <[hidden email]> wrote:
C:\Python\python.exe "D:/Python/django reset framework/secondtestdjrstapi/users/views.py"
Traceback (most recent call last):
  File "D:/Python/django reset framework/secondtestdjrstapi/users/views.py", line 2, in <module>
    from rest_framework.authtoken.models import Token
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 11, in <module>
    class Token(models.Model):
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 17, in Token
    settings.AUTH_USER_MODEL, related_name='auth_token',
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 57, in __getattr__
    self._setup(name)
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 42, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/28D4A2BE-35AC-45F0-8A28-B3AA46495AC4%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Sidnei Pereira
In reply to this post by Tushar Khairnar
It seems you are trying to execute de `views.py` module directly. As you are running Django you should run it's webserver through `manage.py` so Django you setup everything it is expected and the process starts to listen to port: So:

python manage.py runserver

It will run the server by default in the localhost and port 8000. To test your `view` open the browser and type the correspondent URL (http://localhost:8000/this_view_url/) for that view.

Actually I strongly recommend you to go through the "Getting started with Django" (https://www.djangoproject.com/start/)

*P.S.: Looks like you are using PyCham IDE and there you hit play/run button to start the application but before it needs to be correctly setup. It may vary from professional to community version, but you Basically have to add a run configuration (next to the play button on the top right). In pro version just choose "Django server" on the template's list, usually the default values are good to go. The community one does not have the "Django Server" on the list so choose "Python" and type the runserver command as explained before.

Em quarta-feira, 5 de dezembro de 2018 10:28:01 UTC-2, Tushar Khairnar escreveu:
C:\Python\python.exe "D:/Python/django reset framework/secondtestdjrstapi/users/views.py"
Traceback (most recent call last):
  File "D:/Python/django reset framework/secondtestdjrstapi/users/views.py", line 2, in <module>
    from rest_framework.authtoken.models import Token
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 11, in <module>
    class Token(models.Model):
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 17, in Token
    settings.AUTH_USER_MODEL, related_name='auth_token',
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 57, in __getattr__
    self._setup(name)
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 42, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f0597428-5b2b-41a3-93cc-1fd326b1f828%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Parker Bernard
how do i open my django in my pycharm or python


On Thu, Dec 6, 2018, 3:40 PM Sidnei Pereira <[hidden email] wrote:
It seems you are trying to execute de `views.py` module directly. As you are running Django you should run it's webserver through `manage.py` so Django you setup everything it is expected and the process starts to listen to port: So:

python manage.py runserver

It will run the server by default in the localhost and port 8000. To test your `view` open the browser and type the correspondent URL (http://localhost:8000/this_view_url/) for that view.

Actually I strongly recommend you to go through the "Getting started with Django" (https://www.djangoproject.com/start/)

*P.S.: Looks like you are using PyCham IDE and there you hit play/run button to start the application but before it needs to be correctly setup. It may vary from professional to community version, but you Basically have to add a run configuration (next to the play button on the top right). In pro version just choose "Django server" on the template's list, usually the default values are good to go. The community one does not have the "Django Server" on the list so choose "Python" and type the runserver command as explained before.

Em quarta-feira, 5 de dezembro de 2018 10:28:01 UTC-2, Tushar Khairnar escreveu:
C:\Python\python.exe "D:/Python/django reset framework/secondtestdjrstapi/users/views.py"
Traceback (most recent call last):
  File "D:/Python/django reset framework/secondtestdjrstapi/users/views.py", line 2, in <module>
    from rest_framework.authtoken.models import Token
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 11, in <module>
    class Token(models.Model):
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 17, in Token
    settings.AUTH_USER_MODEL, related_name='auth_token',
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 57, in __getattr__
    self._setup(name)
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 42, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f0597428-5b2b-41a3-93cc-1fd326b1f828%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFDnJVVwvt1y6NTvoVccWD8B59JHjLFt0%3Dy8b0tAYbhBGa517w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Sidnei Pereira
Take a look on this article.

https://automationpanda.com/2017/09/14/django-projects-in-pycharm-community-edition/

Em quinta-feira, 6 de dezembro de 2018 15:18:22 UTC-2, Parker Bernard escreveu:
how do i open my django in my pycharm or python


On Thu, Dec 6, 2018, 3:40 PM Sidnei Pereira <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="yCeJr5fiAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sid...@... wrote:
It seems you are trying to execute de `views.py` module directly. As you are running Django you should run it's webserver through `manage.py` so Django you setup everything it is expected and the process starts to listen to port: So:

python manage.py runserver

It will run the server by default in the localhost and port 8000. To test your `view` open the browser and type the correspondent URL (<a href="http://localhost:8000/this_view_url/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8000%2Fthis_view_url%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHR7mtIqQm20-vKUXmkkz7uxm-akg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8000%2Fthis_view_url%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHR7mtIqQm20-vKUXmkkz7uxm-akg&#39;;return true;">http://localhost:8000/this_view_url/) for that view.

Actually I strongly recommend you to go through the "Getting started with Django" (<a href="https://www.djangoproject.com/start/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.djangoproject.com%2Fstart%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFyvdgwslXoul4OOqWOVZUUeXGZYg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.djangoproject.com%2Fstart%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFyvdgwslXoul4OOqWOVZUUeXGZYg&#39;;return true;">https://www.djangoproject.com/start/)

*P.S.: Looks like you are using PyCham IDE and there you hit play/run button to start the application but before it needs to be correctly setup. It may vary from professional to community version, but you Basically have to add a run configuration (next to the play button on the top right). In pro version just choose "Django server" on the template's list, usually the default values are good to go. The community one does not have the "Django Server" on the list so choose "Python" and type the runserver command as explained before.

Em quarta-feira, 5 de dezembro de 2018 10:28:01 UTC-2, Tushar Khairnar escreveu:
C:\Python\python.exe "D:/Python/django reset framework/secondtestdjrstapi/users/views.py"
Traceback (most recent call last):
  File "D:/Python/django reset framework/secondtestdjrstapi/users/views.py", line 2, in <module>
    from rest_framework.authtoken.models import Token
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 11, in <module>
    class Token(models.Model):
  File "C:\Python\lib\site-packages\rest_framework\authtoken\models.py", line 17, in Token
    settings.AUTH_USER_MODEL, related_name='auth_token',
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 57, in __getattr__
    self._setup(name)
  File "C:\Python\lib\site-packages\django\conf\__init__.py", line 42, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="yCeJr5fiAgAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="yCeJr5fiAgAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/f0597428-5b2b-41a3-93cc-1fd326b1f828%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/f0597428-5b2b-41a3-93cc-1fd326b1f828%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/f0597428-5b2b-41a3-93cc-1fd326b1f828%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/f0597428-5b2b-41a3-93cc-1fd326b1f828%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7630b8e9-cc99-492f-b5b0-ce2631a71a59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.