Admin Site: TemplateDoesNotExist at /admin/

前端 未结 16 1860
鱼传尺愫
鱼传尺愫 2020-12-09 04:00

I\'m following Django\'s official Tutorial 2 but for some reason cannot create an admin site despite following all the steps correctly to my understanding.

This is t

16条回答
  •  醉话见心
    2020-12-09 04:23

    Since it works on other people's machines, and since you have the app directories loader enabled, admin site enabled in INSTALLED_APPS, and that's all it should take for templates to be discovered (I mean, what more can one do?) - I can only assume something is wrong with your django installation.

    This would be a good chance to start using virtualenvs and a fresh install of django to rule out your settings:

    Fire up a terminal, navigate to your project directory (doesn't actually matter...)

    pip install virtualenv # if you don't have it.
    
    virtualenv --no-site-packages env 
    # this creates a virtual python environment that doesn't include system packages
    
    source env/bin/activate
    # this forces your bash session to use that environment
    
    pip install django
    # installs a fresh copy of django to your new environment
    
    cd path_to_my_django_project    
    # now go to your site directory
    
    python manager.py runserver
    # visit admin site.
    

提交回复
热议问题