xi / django-mfa3

multi factor authentication for django
MIT License
22 stars 8 forks source link

add STATIC_URL in middleware exclude #21

Closed lsaavedr closed 3 weeks ago

lsaavedr commented 3 months ago

Hi,

with this PR can be importing css or other stuff from static files,

regards!

xi commented 3 months ago

I don't see why this should be necessary. In production you usually don't serve static files from django, so the request doesn't go through the middleware. In development you usually use the staticfiles app, which doesn't go through middleware either.

Am I missing something? Can you provide a reproducable case in which this makes a difference?

lsaavedr commented 3 months ago

this is necessary to develop with any ASGI server like uvicorn or daphne that serve static files through middleware, I think that others developers also work in development with ASGI servers to manage async viewers or channels

xi commented 3 months ago

Can you provide more details on your setup? The official documentation does not mention anything special about static files. Any tutorials I found (e.g. this one also recommended to bypass django when serving static files. So I tend to believe that this is an issue with your setup rather than django-mfa3.