4 directories: pycache, migrations, static, templates
Then I have the following .py files:
init
admin
apps
forms
models
tests
urls
views
4 directories: pycache, migrations, static, templates
Then I have the following .py files:
init
admin
apps
forms
models
tests
urls
views
Ok, for what we’re trying to find here, we can probably work with just the contents of the static directory within blog.
blog/static contains:
admin/ and images/The admin/ directory contains 127 files and 12 folders
The images/ directory contains 1 file (game_controller.jpg) and 0 folders
Unfortunately, I can’t recreate the behavior you’re describing here with the information provided. Aside from having unnecessary copies of the static files used by the admin, I don’t see anything fundamentally wrong.
What I would recommend as next steps:
admin directoriesrunserver stopped, verify that you don’t have a zombie runserver process still executing. (Stop runserver and try to access the server from your browser. If you get a response, then you have a zombie process still running.)runserver command, from the command line being issued up to when the first page with static file references being requested.I seem to have fixed the issue.
I did so by adding the following to settings.py:
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
And updating personal_blog/urls.py:
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('blog.urls')), # Include your blog URLs
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Hopefully this helps someone else. It must have been a step I missed at some stage.
These settings have nothing to do with static files. Making these specific changes would not have fixed the issue you described - it would have been coincidental with some other change or correction being made.
(I’m only pointing this out because this - by itself - is highly unlikely to resolve anyone else’s static file issue.)