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

JSONDecodError at /blog/ #7

Open
hybridpicker opened this issue Apr 27, 2019 · 7 comments
Open

JSONDecodError at /blog/ #7

hybridpicker opened this issue Apr 27, 2019 · 7 comments

Comments

@hybridpicker
Copy link

  • Django Wordpress API version: 0.2.0
  • Python version: 3

Trying to integrate Wordpress blog into a Django Project.
Set it up like its described in the Django Wordpress API:

First, I checked if WP Rest API isn't disabled.

Then I added these lines after pip install django-wordpress-api-plugin:

settings.py:

 INSTALLED_APPS += ('wordpress_api',)

 WP_URL = 'https://wordpress-site.com/blog'

views.py:

 import wordpress_api
 
 re_path(r'^blog/', include('wordpress_api.urls')),

Tried manage.py runserver and localhost:8000/blog.

Then this Error disappeard:

  JSONDecodeError at /blog/
  Expecting value: line 1 column 1 (char 0)
  Request Method:	GET
  Request URL:	http://localhost:8000/blog/

Hoping for some hints how to fix that problem

@kallewesterling
Copy link
Contributor

Did you change the WP_URL setting to a URL that contained a valid WordPress blog? (I.e. the https://wordpress-site.com/blog example setting is not a valid setting...!) If not, the module will not be able to find valid JSON data from the WordPress site to display to you at /blog/.

@cdvv7788 - it might be a good idea to build out the error reporting to clarify this. Perhaps before displaying the JSONDecodeError, if WP_URL is set to the example URL, an output could clarify to the user that they need to change the example to a valid URL?

@windel07
Copy link

@kallewesterling Does the WP_URL needs to be on same domain? Its working when wp and django are both on localhost.

But when testing on a dev site, its not working when using wp site on separate domain.

@kallewesterling
Copy link
Contributor

Are you getting the same error message as above? Otherwise I think you should open a new issue!

@windel07
Copy link

@kallewesterling Actually im getting 404 in /blog/ page. I havent tried using wp_url from same domain

@kallewesterling
Copy link
Contributor

That is a different problem and you should open a new issue.

@windel07
Copy link

@kallewesterling I made a new ticket : #15

@kallewesterling
Copy link
Contributor

Great, good luck!

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

No branches or pull requests

3 participants