ERROR __init__() takes exactly 1 argument (3 given) on Django with GAE
<p>Im trying to solve one problem that I have on my admin of one Django App.</p>

<p>I have this code:</p>

<p>admin_main.py:</p>

<pre><code>application = webapp.WSGIApplication([
# Admin pages
(r'^(/admin/add_img)', admin.views.AddImage),
(r'^(/admin)(.*)$', admin.Admin),])
</code></pre>

<p>admin/views.py:</p>

<pre><code>class BaseRequestHandler(webapp.RequestHandler):
def handle_exception(self, exception, debug_mode):
    logging.warning("Exception catched: %r" % exception)
    if isinstance(exception, Http404) or isinstance(exception, Http500):
        self.error(exception.code)
        path = os.path.join(ADMIN_TEMPLATE_DIR, str(exception.code) + ".html")
        self.response.out.write(template.render(path, {'errorpage': True}))
    else:
        super(BaseRequestHandler, self).handle_exception(exception, debug_mode)

class Admin(BaseRequestHandler):

def __init__(self, request,response):
    logging.info("NEW Admin object created")
    super(Admin, request, response).__init__()
    # Define and compile regexps for Admin site URL scheme.
    # Every URL will be mapped to appropriate method of this
    # class that handles all requests of particular HTTP message
    # type (GET or POST).
    self.getRegexps = [
        [r'^/?$', self.index_get],
        [r'^/([^/]+)/list/$', self.list_get],
        [r'^/([^/]+)/new/$', self.new_get],
        [r'^/([^/]+)/edit/([^/]+)/$', self.edit_get],
        [r'^/([^/]+)/delete/([^/]+)/$', self.delete_get],
        [r'^/([^/]+)/get_blob_contents/([^/]+)/([^/]+)/$', self.get_blob_contents],
    ]
    self.postRegexps = [
        [r'^/([^/]+)/new/$', self.new_post],
        [r'^/([^/]+)/edit/([^/]+)/$', self.edit_post],
    ]
    self._compileRegexps(self.getRegexps)
    self._compileRegexps(self.postRegexps)
    # Store ordered list of registered data models.
    self.models = model_register._modelRegister.keys()
    self.models.sort()
    # This variable is set by get and port methods and used later
    # for constructing new admin urls.
    self.urlPrefix = ''

def index_get(self):
    """Show admin start page
    """
    path = os.path.join(ADMIN_TEMPLATE_DIR, 'index.html')
    self.response.out.write(template.render(path, {
        'models': self.models,
        'urlPrefix': self.urlPrefix,
    }))
</code></pre>

<p>And when I try to get the page <a href="http://localhost:8080/admin" rel="nofollow">http://localhost:8080/admin</a>, I get the next error:</p>

<pre><code>    ERROR    2016-10-10 14:37:25,484 webapp2.py:1528] __init__() takes exactly 1 argument (3 given)
Traceback (most recent call last):
  File "C:\Users\Yisus-MSI\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1511, in __call__
    rv = self.handle_exception(request, response, e)
  File "C:\Users\Yisus-MSI\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1505, in __call__
    rv = self.router.dispatch(request, response)
  File "C:\Users\Yisus-MSI\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1253, in default_dispatcher
    return route.handler_adapter(request, response)
  File "C:\Users\Yisus-MSI\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\webapp2-2.3\webapp2.py", line 1076, in __call__
    handler = self.handler(request, response)
TypeError: __init__() takes exactly 1 argument (3 given)
</code></pre>

<p>I try a lot of solutions of the forum, but no one works.</p>

<p>Thanks for your help.</p>

<p>I believe you made a mistake in using <code>super()</code>, you need to change in your <code>Admin.__init__()</code> method:</p>

<pre><code>super(Admin, request, response).__init__()
</code></pre>

<p>to:</p>

<pre><code>super(Admin, self).__init__(request=request, response=response)
</code></pre>

python python-2.7 google-app-engine webapp2