question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Middleware Errors on New Project

See original GitHub issue

Generated a brand new project this morning using master. Installed requirements and ran the initial migrations. No changes were made to the generated code. Wondering if this error might be related to this PR which was merged about 10 hours ago: https://github.com/pydanny/cookiecutter-django/pull/793.

Thank you everyone for your work on this great project.

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fd59fc8f510>
Traceback (most recent call last):
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 142, in inner_run
    handler = self.get_handler(*args, **options)
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
    handler = super(Command, self).get_handler(*args, **options)
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 64, in get_handler
    return get_internal_wsgi_application()
  File "/home/bill/.virtualenvs/xxxy/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 49, in get_internal_wsgi_application
    return import_string(app_path)
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/utils/module_loading.py", line 20, in import_string
    module = import_module(module_path)
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/bill/projects/xxx/config/wsgi.py", line 30, in <module>
    application = get_wsgi_application()
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
    return WSGIHandler()
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 153, in __init__
    self.load_middleware()
  File "/home/bill/.virtualenvs/xxx/lib/python3.5/site-packages/django/core/handlers/base.py", line 82, in load_middleware
    mw_instance = middleware(handler)
TypeError: __init__() takes 1 positional argument but 2 were given

Project Settings:

~/projects$ cookiecutter https://github.com/pydanny/cookiecutter-django
You've cloned /home/bill/.cookiecutters/cookiecutter-django before. Is it okay to delete and re-clone it? 
[yes]: yes
Cloning into 'cookiecutter-django'...
remote: Counting objects: 8020, done.
remote: Total 8020 (delta 0), reused 0 (delta 0), pack-reused 8019
Receiving objects: 100% (8020/8020), 2.86 MiB | 0 bytes/s, done.
Resolving deltas: 100% (5187/5187), done.
Checking connectivity... done.
project_name [Project Name]: xxx
project_slug [xxx]: xxx
author_name [Daniel Roy Greenfeld]: xxx
email [you@example.com]: xxx
description [A short description of the project.]: xxx
domain_name [example.com]: xxx.com
version [0.1.0]: 
timezone [UTC]: 
use_whitenoise [y]: n
use_celery [n]: n
use_mailhog [n]: y
use_sentry_for_error_reporting [y]: n
use_opbeat [n]: y
use_pycharm [n]: y
windows [n]: n
use_python3 [y]: y
use_docker [y]: n
use_heroku [n]: n
use_elasticbeanstalk_experimental [n]: n
use_compressor [n]: n
Select postgresql_version:
1 - 9.5
2 - 9.4
3 - 9.3
4 - 9.2
Choose from 1, 2, 3, 4 [1]: 1
Select js_task_runner: 3
1 - Gulp
2 - Grunt
3 - None
Choose from 1, 2, 3 [1]: 3
use_lets_encrypt [n]: n
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]: 5


Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
chromakeycommented, Sep 29, 2016

@luzfcb using your instructions above I was able to get it to run successfully with no additional changes.

1reaction
chromakeycommented, Sep 29, 2016

I think I found the issue. It’s with django-debug-toolbar. Commenting it out in the configuration seems to get everything to work. I found this recently merged PR:

https://github.com/jazzband/django-debug-toolbar/pull/879

It looks like pypi hasn’t been updated yet to reflect the merged changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Middleware Errors on New Project · Issue #827 - GitHub
Generated a brand new project this morning using master. Installed requirements and ran the initial migrations. No changes were made to the ...
Read more >
Error handling - Express.js
Express comes with a built-in error handler that takes care of any errors that might be encountered in the app. This default error-handling...
Read more >
A Guide to Error Handling in Express.js | Scout APM Blog
Basic Quick Tutorial: Setting up Error Handling in Express.js · Step 1: Create and Setup Project · Step 2: Setup the Server ·...
Read more >
middleware/Errors in a Node.js project - Stack Overflow
I am having a bit of a hard time getting back to a Node.js project after a while. I need to implement some...
Read more >
Handle errors in ASP.NET Core | Microsoft Learn
This exception handling middleware: Catches and logs unhandled exceptions. Re-executes the request in an alternate pipeline using the path ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found