Friday, April 24, 2015

Re: django 1.8.1 : A server error occurred. Please contact the administrator.

On 25/04/2015 3:13 AM, JMKoushyar wrote:
> Ho guys, I'm new to django framework. According to Instructions in the
> djangoproject.com I did all the things and everything was pretty good
> but when I tried to open my django project in browser by "python
> manage.py runserver", I got some errors. The page error is : A server
> error occurred. Please contact the administrator.

It would be helpful to see the code which generates the error. But
anyway, I think it is identified in your stack trace here ...

class_name = dotted_path.rsplit('.', 1)
ImportError: polls doesn't look like a module path

... where you import polls, are you using a backslash anywhere? The
framework is expecting a dot instead of a slash or (in your case) backslash.

For example, you might be using "from myproject\polls import something"
and that should instead be "from myproject.polls import something"

What makes this work is the existence of a (probably empty) file called
__init__.py in each directory on either side of the path separator
(unix/linux/mac slash or windows backslash) so you might also check you
have those __init__.py files in place.

hth

Mike



>
> Also Here Is the command prompt errors given :
>
> """C:\Users\Javad\Desktop\havij>python manage.py runserver Performing
> system checks... System check identified no issues (0 silenced). April
> 24, 2015 - 21:34:56 Django version 1.8, using settings 'havij.settings'
> Starting development server at http://127.0.0.1:8000/ Quit the server
> with CTRL-BREAK. Traceback (most recent call last): File
> "C:\Python34\lib\site-packages\django\utils\module_loading.py", line 21,
> in import_string module_path, class_name = dotted_path.rsplit('.', 1)
> ValueError: need more than 1 value to unpack During handling of the
> above exception, another exception occurred: Traceback (most recent call
> last): File "C:\Python34\lib\wsgiref\handlers.py", line 137, in run
> self.result = application(self.environ, self.start_response) File
> "C:\Python34\lib\site-packages\django\contrib\staticfiles\handlers.py",
> l ine 63, in __call__ return self.application(environ, start_response)
> File "C:\Python34\lib\site-packages\django\core\handlers\wsgi.py", line
> 170, i n __call__ self.load_middleware() File
> "C:\Python34\lib\site-packages\django\core\handlers\base.py", line 50,
> in load_middleware mw_class = import_string(middleware_path) File
> "C:\Python34\lib\site-packages\django\utils\module_loading.py", line 24,
> in import_string six.reraise(ImportError, ImportError(msg),
> sys.exc_info()[2]) File
> "C:\Python34\lib\site-packages\django\utils\six.py", line 658, in
> reraise raise value.with_traceback(tb) File
> "C:\Python34\lib\site-packages\django\utils\module_loading.py", line 21,
> in import_string module_path, class_name = dotted_path.rsplit('.', 1)
> ImportError: polls doesn't look like a module path [24/Apr/2015
> 21:35:04]"GET / HTTP/1.1" 500 59 Traceback (most recent call last): File
> "C:\Python34\lib\site-packages\django\utils\module_loading.py", line 21,
> in import_string module_path, class_name = dotted_path.rsplit('.', 1)
> ValueError: need more than 1 value to unpack During handling of the
> above exception, another exception occurred: Traceback (most recent call
> last): File "C:\Python34\lib\wsgiref\handlers.py", line 137, in run
> self.result = application(self.environ, self.start_response) File
> "C:\Python34\lib\site-packages\django\contrib\staticfiles\handlers.py",
> l ine 63, in __call__ return self.application(environ, start_response)
> File "C:\Python34\lib\site-packages\django\core\handlers\wsgi.py", line
> 170, i n __call__ self.load_middleware() File
> "C:\Python34\lib\site-packages\django\core\handlers\base.py", line 50,
> in load_middleware mw_class = import_string(middleware_path) File
> "C:\Python34\lib\site-packages\django\utils\module_loading.py", line 24,
> in import_string six.reraise(ImportError, ImportError(msg),
> sys.exc_info()[2]) File
> "C:\Python34\lib\site-packages\django\utils\six.py", line 658, in
> reraise raise value.with_traceback(tb) File
> "C:\Python34\lib\site-packages\django\utils\module_loading.py", line 21,
> in import_string module_path, class_name = dotted_path.rsplit('.', 1)
> ImportError: polls doesn't look like a module path [24/Apr/2015
> 21:35:06]"GET / HTTP/1.1" 500 59"""
>
> Please help me :|, I really need your help guys.
>
> --
> 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 django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d14d2fde-f022-4234-b4f7-9decc0748a1f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d14d2fde-f022-4234-b4f7-9decc0748a1f%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/553AD4A7.4040206%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment