how to show a django application inside a site in wordpress - python

I have a site made in wordpress and i´d like to show my django application inside this site. I don´t know how to do that. How do call my django application and show it inside the site.

Your other option - far more work and technical than using an iframe - is to show the content in the WordPress site by using django-rest-framework (on the Django app) then pulling in the content via API requests.
It would be a lot of work, but well worth learning and provide you the most flexibility.
The steps would be
Install django-rest-framework for your Django app
Setup up and configure an API
Either use PHP on the server or JavaScript on the frontend to pull in the content from the API

Only using iframes, because they bore are diffrerent frameworks using different languages etc... so you will make to make one iframe inside your wordpress page and inside that page to load one url from your django application
https://www.w3schools.com/tags/tag_iframe.asp

try to detail your issue. Do you need a link in your wordpress´site ? have you tried loading it using iframe ?
It´s really important to show inside a wordpress´site ?

Related

How To Load The Next Page When User Scrolls Down In Django

I was trying to build a blog website and was wondering to add a functionality that loads a new page as the user scroll down. I found some other answers to this but they all have some JSON or Javascript in them. As I Don't know any of these languages, I was wondering if there was a way I can do this just using Django Pagination And Stuff.
Thanks In Advance.
Django will only run on your server. The client won't run any python related code on their machine.
Usually, browsers display HTML/CSS and can run client-side code in JavaScript.
So since the browser does not get in contact with django itself, you must use JavaScript to do anything after the page has been loaded.
It's not much javascript you will need, so start reading this: https://www.w3schools.com/js/
Information on how to get the scrollbar in JS: How to get scrollbar position with Javascript?
You can install Django EL(Endless) Pagination and using this package to endless pagination. Using and configuration of this package is very simple.

How can I embed Superset Apache into Flask web app?

I have a flask web application with many pages where users can insert some data stored in mysql using sqlalchemy. I would create another page with an interactive dashboard. I googled and I found superset that it seems perfect for my app. It's possible embed apache superset (or similar) into my web app? There are some tutorial?
It is possible to embed Apache Superset in any web application using iframe. Copy the URL of the dashboard that you want to embed and add ?standalone=true at the end. This URL can be used in the iframe to render the application.
Problem with the solution:
In the above mentioned method you will be seeing login page inside the iframe when you access the dashboard. You will have to login to the web application and then login to Superset.
Possible solutions
You can make the dashboard public as mentioned in the doc: https://superset.incubator.apache.org/security.html?highlight=public#public
Implement a custom authenticator as mentioned in the post: https://medium.com/#sairamkrish/apache-superset-custom-authentication-and-integrate-with-other-micro-services-8217956273c1
I would recommend the second approach as it would give protection to your data.

How to create empty wordpress permalink and redirect it into django website?

I need to do such thing, but I don't even know if it is possible to accomplish and if so, how to do this.
I wrote an Django application which I would like to 'attach' to my wordpress blog. However, I need a permalink (but no page in wordpress pages section) which would point to Django application on the same server. Is that possible?
You can use the "Page links to" wordpress plugin to point to any url: https://wordpress.org/plugins/page-links-to/
There are many ways to do this. You will have to provide more info about what you are trying to accomplish to give the right advise.
make a page with a redirect (this is an ugly solution in seo and user perspective)
handle this on server level.
load your Django data with an ajax call

Python backend and html/ajax front end, need suggestions for my application

Currently I have written a python script that extracts data from flickr site, and dump as a python class object and YAML file.
I was planning to turn this into a website:
and a simple html front page that can send a request to the backend, triggers the python scripts running on the backend
the response will be parsed and render as a table on the html page.
As i am very new to python, I am not sure how to plan my project. is there any suggestions for building this application? any framework or technologies i should use? For example, i guess i should use ajax in the front end, how about the backend?
Thanks in advance for your suggestions!
You can look on Django or Flask.
As for me, Flask is much better for you, because it smallest and simplier. You can read about building Flask app here:
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
And about Django here:
http://www.djangobook.com/en/2.0/index.html
I used both for building applications with AJAX.
Please note that Django has better Python 3 support.
Also you can see on Bottle or something other. Try google if you'll dislike Django and Flask. For example, comparison of Python web frameworks:
http://www.sixfeetup.com/blog/4-python-web-frameworks-compared
you should use Django framework for your app. You can integrate your scripts into Django views. And you can also use the loaddata system in order to insert your yaml data into the database

Facebook, Django, and Google App Engine

I'm experimenting with app-engine-patch (Django for GAE) on Google App Engine. And I would like to write a Facebook application. Is it possible to use PyFacebook and its middleware? Or is there some other solution?
I run a system on for social networks and facebook on GAE with back-end in Python, front end in Javascript and Flash. I use mostly client side js libraries to pass data back to the server side datastore. This library for facebook to be exact: http://code.google.com/p/facebookjsapi/
There is a reason for this. Most of what we are doing will be running on its own site, in iframes in different social networks and in widgets etc. But for the most part this has worked very well. It is good because we can swap out our backend at any time or even run it on multiple platforms as it is also using a python rest GAE library but any backend would do with this setup.
Adding the Facebook directory from the PyFacebook install directory to the app-engine-patch application allows you to add 'facebook.djangofb.FacebookMiddleware', to the MIDDLEWARE_CLASSES in settings.py. Then your view can use 'import facebook.djangofb as facebook' and '#facebook.require_login().'
I haven't gone end to end, but when I tried to display the view preceded by '#facebook.require_login()', I was redirected to the Facebook login.
According to this post, you need a slightly modified PyFacebook that you can download from a URL given in said post (I haven't tried it myself, though).
Edit: that link is wrong -- better link and more discussion on this thread.

Categories

Resources