[Answer]-AttributeError: 'module' object has no attribute 'META' in Django Project

1👍

This is really a big code bulder.

This piece of code here makes no sense inside the manage.py

from django.http import request

server = request.META.get('wsgi.file_wrapper', None)
if server is not None and server.__module__ == 'django.core.servers.basehttp':
    print('inside dev')

Perhaps you copied it from somewhere, and didn’t put it where it belongs.

This piece of coude would belong in a view. It will never work inside manage.py, and makes asolutely no sense there.

[EDIT]
ALSO, in a view, you should NOT include the import, or you’ll get the same error. That means, don’t include this from django.http import request

Leave a comment