Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 Not Found after upgrade to 2.3 #685

Closed
danielcwj16 opened this issue Jun 20, 2019 · 17 comments
Closed

404 Not Found after upgrade to 2.3 #685

danielcwj16 opened this issue Jun 20, 2019 · 17 comments

Comments

@danielcwj16
Copy link

Just upgraded to 2.3. Then cannot open graphql site anymore. It shows graphiql.js file not found.

Screen Shot 2019-06-19 at 11 10 41 PM

Screen Shot 2019-06-19 at 11 14 18 PM

#683 looks similar to my issue, but I can't pull up the site with what @brandonmbanks did.

@phalt
Copy link
Contributor

phalt commented Jun 20, 2019

Have you ran python manage.py collectstatic ?

@shoof1072
Copy link

Could this be related to #508?

Our project pulled in 2.3.0 and we observed the same 404, both FF and Chrome render a blank page at the /graphql/ path, and observed the following printed to our service log:

WARNING:django.request:Not Found: /static/graphene_django/graphiql.js

We've rolled back and pinned to 2.2.0 for now.

@danielcwj16
Copy link
Author

Have you ran python manage.py collectstatic ?

I tried this and it created a static folder with that graphene_django/graphiql.js in it. But still can not open the page, console gave the same error message.

@phalt
Copy link
Contributor

phalt commented Jun 21, 2019

We've just pushed out 2.3.2, can you check this is still occurring in that version? I am running 2.3 locally on my machine and I'm having no issues.

@danielcwj16
Copy link
Author

We've just pushed out 2.3.2, can you check this is still occurring in that version? I am running 2.3 locally on my machine and I'm having no issues.

Still not works

@jkimbo
Copy link
Member

jkimbo commented Jun 24, 2019

@danielcwj16 have you added graphene_django to your INSTALLED_APPS list in settings.py? django.contrib.staticfiles also needs to be in that list.

@evanheckert
Copy link

@jkimbo I have both of those in place, and have run collectstatic and am experiencing the same issue. Rollback to 2.2 solves it for now.

@jkimbo
Copy link
Member

jkimbo commented Jun 26, 2019

@evanheckert can you share your static file settings in settings.py? Or even better if you could create a reproduction of the issue that would be very helpful.

@dacevedo12
Copy link

@jkimbo We're experiencing the same problem. Here's what our static settings look like
image

It works in the local development server but then fails after the app is deployed and served through wsgi

@jkimbo
Copy link
Member

jkimbo commented Aug 1, 2019

@dacevedo12 can you create a full reproduction of the issue (as a github repo)? I can't reproduce the problem.

@jkimbo
Copy link
Member

jkimbo commented Aug 1, 2019

Actually @dacevedo12 I think you need os.path.join(PROJECT_ROOT, "static"), in your STATICFILES_DIRS setting and you need to make sure you run manage.py collectstatic as part of your deployment process.

@Ouradze
Copy link

Ouradze commented Sep 13, 2019

This is still present in 2.5 :) You can reproduce it with https://gitlab.com/eclar/django_deploy but only with the production image.

@stale
Copy link

stale bot commented Dec 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 12, 2019
@evanheckert
Copy link

This is still present in 2.5 :) You can reproduce it with https://gitlab.com/eclar/django_deploy but only with the production image.

Still an issue.

@stale stale bot removed the wontfix label Dec 13, 2019
@mmitsui
Copy link

mmitsui commented Jan 23, 2020

Has anyone tried updating urls.py as per the Django docs on static files (Serving static files during development)? This seemed to resolve the issue for me.

@evanheckert
Copy link

@mmitsui Yes, of course.

# urls.py
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
from django.views.decorators.csrf import csrf_exempt

from graphene_django.views import GraphQLView

urlpatterns = [
    path("__admin/", admin.site.urls), 
    path("gqlendpoint/", csrf_exempt(GraphQLView.as_view(graphiql=True)))
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

And..

# settings.py
import os
...
...
STATIC_URL = "/static/"
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(BASE_DIR, "static/")

@jkimbo
Copy link
Member

jkimbo commented Jan 30, 2020

@evanheckert @Ouradze @dacevedo12 when running Django with DEBUG=False it will not host static files for you (ref). You will need to run a server to host the static assets or use something like whitenoise to get the python process to host them. Once you have that setup it should work fine.

The reason this changed in v2.3 is that we moved the graphiql javascript bundle into a separate file: #508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants