How can I embed Superset Apache into Flask web app? - python

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.

Related

How to host number of websites under similer url

I have a site build in site123 (site123 is a WYSIWYG and it dose not support code export). I use it as a nice designed landing page and product's catalog. so I have:
https://app.site123.com/?w=my_site this site has no back-end (not supported by site123). and I have another site build in django for payments and other stuff like this I host it on pythonanywhere, So I also have http://my_website_with_backed.pythonanywhere.com/.
Now, I buy a domain from GoDaddy and I would like to know if there is a way to connect the 2 websites under the same url??. like:
site123 website: www.catalog.my_own_url.com
django website: www.payment.my_own_url.com
Thank you
You can do a redirect from the subdomains to your page but in this case you will have the 3rd party URL displayed and not your subdomain.
You can probably use a simple HTML structure with iFrames to include your page. Like connecting your subdomains with a server and hosting there a HTML page which loads your python or WYSIWYG page.
If site123 is a static landing page without many changes or dynamic elements, I would think about scraping it with a script and transfer it to a server which also supports python (e.g. Amazon AWS). In this case you can get rid of pythonanymwhere and use your subdomains.
Then you can either use site123 (and scrape it every night for example) or use another WYSIWYG editor to build a page and deploy it to your server.

how to show a django application inside a site in wordpress

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 ?

How can I create an API for my web app and the mobile version of that web app in python?

I'm new to the API concept.I have a doubt about the API. I created a web app in Python-django framework.I need to create an API for this web application.I need to use this same app in mobile as mobile app.How can I possible this?
Can I create seperate API for the mobile app also? I searched this in google. but i can't find a correct answer.Please help me...
An API does not care if the client that sends the requests is a mobile app or browser (unless of course you send and use the information on purpose). For example if your API exposes the "www.myapp.com/registeruser/" URL and requires a POST with username and password, you can call this URL with those parameters from any client that is able to send that.
If what you want is use the same client-side code for both desktop and mobile (trying to understand what you need!), you can look at responsive websites. A package like django-bootstrap3 works very well with Django and is easy to use.
If your goal is to develop a native mobile application that will consume your API, then you can use Django REST framework to add API endpoint to your current Django application. One possibility is that you will have another file added in every app of your Django project, and it is serializers.py (at the same level as models.py).

Consume web service with DJANGO

I have a django application to show some data from my database (ORACLE), but now I need to show some data from a web service.
I need to build a form based in the request of the web service, and show the response of the web service.
I googling to expose my app as a web service and send and retrieve XML data.
But I am very confused and I don't know where to start or which django package to use(PyXML,DJANGO REST).
I am not sure if I need to build a web API or I can consume the web service without the web api.
Can someone give some advices to achieve this task.
You don't need to build a web API if all you want to do is consume someone else's API. Just retrieve the data - with something like requests - and use it in your Django app.

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