Giter Site home page Giter Site logo

flask-react-docker-app's Introduction

Social banner for martindavid

Hello, folks!

My name is Martin Valentino and I'm a husband, father and a software engineer. I'm from Indonesia, living in Melbourne, Australia and currently working at CultureAmp, while also build RLXYZ. You can find me on Twitter, or on LinkedIn.

โœ Blog & Writing

Apart from coding, I also maintain a blog - you can find my articles on my website at martinlabs.me as well as on Medium and DEV.to.

๐Ÿ”ง Technologies & Tools

flask-react-docker-app's People

Contributors

bruising6802 avatar martindavid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flask-react-docker-app's Issues

TypeError: 'str' object is not callable

How to reproduce

# Start 
$ docker-compose up

# Run database migration
$ docker-compose exec api python manage.py db upgrade

# Run database seed
$ docker-compose exec api python manage.py seed_db

Go to:

http://localhost:8080/login

inspect the page and try login

If you look at request those errors are shown:

TypeError
TypeError: 'str' object is not callable

Traceback (most recent call last)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2464, in call

def __call__(self, environ, start_response):
    """The WSGI server calls the Flask application object as the
    WSGI application. This calls :meth:`wsgi_app` which can be
    wrapped to applying middleware."""
    return self.wsgi_app(environ, start_response)

def __repr__(self):
    return "<%s %r>" % (self.__class__.__name__, self.name)

File "/usr/local/lib/python3.7/site-packages/werkzeug/middleware/proxy_fix.py", line 169, in call
self.x_prefix, environ_get("HTTP_X_FORWARDED_PREFIX")
)
if x_prefix:
environ["SCRIPT_NAME"] = x_prefix

    return self.app(environ, start_response)

File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2450, in wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
File "/usr/local/lib/python3.7/site-packages/flask_restx/api.py", line 638, in error_router
"""
if self._has_fr_route():
try:
return self.handle_error(e)
except Exception as f:
return original_handler(f)
return original_handler(e)

def handle_error(self, e):
    """
    Error handler for the API transforms a raised exception into a Flask response,

File "/usr/local/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
# Wrap exception handlers with cross_origin
# These error handlers will still respect the behavior of the route
if options.get('intercept_exceptions', True):
def _after_request_decorator(f):
def wrapped_function(*args, **kwargs):
return cors_after_request(app.make_response(f(*args, **kwargs)))
return wrapped_function

        if hasattr(app, 'handle_exception'):
            app.handle_exception = _after_request_decorator(
                app.handle_exception)

File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1867, in handle_exception
# if we want to repropagate the exception, we can attempt to
# raise it with the whole traceback in case we can do that
# (the function was actually called from the except part)
# otherwise, we just raise the error again
if exc_value is e:
reraise(exc_type, exc_value, tb)
else:
raise e

    self.log_exception((exc_type, exc_value, tb))
    server_error = InternalServerError()

File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
import collections.abc as collections_abc

def reraise(tp, value, tb=None):
    if value.__traceback__ is not tb:
        raise value.with_traceback(tb)
    raise value

implements_to_string = _identity

else:
iterkeys = lambda d: d.iterkeys()
File "/usr/local/lib/python3.7/site-packages/flask_restx/api.py", line 636, in error_router
:param function original_handler: the original Flask error handler for the app
:param Exception e: the exception raised while handling the request
"""
if self._has_fr_route():
try:
return self.handle_error(e)
except Exception as f:
return original_handler(f)
return original_handler(e)

def handle_error(self, e):

File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
ctx = self.request_context(environ)
error = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)

def finalize_request(self, rv, from_error_handler=False):
    """Given the return value from a view function this finalizes
    the request by converting it into a response and invoking the

File "/usr/local/lib/python3.7/site-packages/flask_restx/api.py", line 638, in error_router
"""
if self._has_fr_route():
try:
return self.handle_error(e)
except Exception as f:
return original_handler(f)
return original_handler(e)

def handle_error(self, e):
    """
    Error handler for the API transforms a raised exception into a Flask response,

File "/usr/local/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
# Wrap exception handlers with cross_origin
# These error handlers will still respect the behavior of the route
if options.get('intercept_exceptions', True):
def _after_request_decorator(f):
def wrapped_function(*args, **kwargs):
return cors_after_request(app.make_response(f(*args, **kwargs)))
return wrapped_function

        if hasattr(app, 'handle_exception'):
            app.handle_exception = _after_request_decorator(
                app.handle_exception)

File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
return self.handle_http_exception(e)

    handler = self._find_error_handler(e)

    if handler is None:
        reraise(exc_type, exc_value, tb)
    return handler(e)

def handle_exception(self, e):
    """Handle an exception that did not have an error handler
    associated with it, or that was raised from an error handler.

File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
import collections.abc as collections_abc

def reraise(tp, value, tb=None):
    if value.__traceback__ is not tb:
        raise value.with_traceback(tb)
    raise value

implements_to_string = _identity

else:
iterkeys = lambda d: d.iterkeys()
File "/usr/local/lib/python3.7/site-packages/flask_restx/api.py", line 636, in error_router
:param function original_handler: the original Flask error handler for the app
:param Exception e: the exception raised while handling the request
"""
if self._has_fr_route():
try:
return self.handle_error(e)
except Exception as f:
return original_handler(f)
return original_handler(e)

def handle_error(self, e):

File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
self.try_trigger_before_first_request_functions()
try:
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)

def finalize_request(self, rv, from_error_handler=False):

File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
getattr(rule, "provide_automatic_options", False)
and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
return self.view_functionsrule.endpoint

def full_dispatch_request(self):
    """Dispatches the request and on top of that performs request
    pre and postprocessing as well as HTTP exception catching and
    error handling.

File "/usr/local/lib/python3.7/site-packages/flask_restx/api.py", line 375, in wrapper
:param resource: The resource as a flask view function
"""

    @wraps(resource)
    def wrapper(*args, **kwargs):
        resp = resource(*args, **kwargs)
        if isinstance(resp, BaseResponse):
            return resp
        data, code, headers = unpack(resp)
        return self.make_response(data, code, headers=headers)

File "/usr/local/lib/python3.7/site-packages/flask/views.py", line 89, in view
constructor of the class.
"""

    def view(*args, **kwargs):
        self = view.view_class(*class_args, **class_kwargs)
        return self.dispatch_request(*args, **kwargs)

    if cls.decorators:
        view.__name__ = name
        view.__module__ = cls.__module__
        for decorator in cls.decorators:

File "/usr/local/lib/python3.7/site-packages/flask_restx/resource.py", line 40, in dispatch_request
if meth is None and request.method == "HEAD":
meth = getattr(self, "get", None)
assert meth is not None, "Unimplemented method %r" % request.method

    for decorator in self.method_decorators:
        meth = decorator(meth)

    self.validate_payload(meth)

    resp = meth(*args, **kwargs)

TypeError: 'str' object is not callable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.