How to host number of websites under similer url - python

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.

Related

How to host Jekyll and static HTML sites under a slash of a Flask Jinja2 site?

Okay, what I want to do seems simple but isn't. Here is what I have and want:
A website created with Flask and Jinja 2: https://www.neuraxio.com/
A documentation website for an open-source library created with sphinx. The output is raw static HTML files: https://www.neuraxle.neuraxio.com/stable/index.html However, I would like to move this website to https://www.neuraxio.com/neuraxle/stable/index.html with redirects from the old subdomain to the new one. The static HTML site is hosted with github pages for now.
I want to create a jekyll blog with github pages because it's simple to manage and create new articles from markdown. Or perhaps a Wordpress blog, but something. I'd like to host that blog under https://www.neuraxio.com/blog/ and not under https://www.blog.neuraxio.com/
I know subdomains are easy to manage from a DNS and hosting standpoint, but I'd like to centralize everything under the same subdomain: www.neuraxio.com.
So, how would you approach solving this problem?
For the static HTML of part 2, it might be as simple as moving the static HTML to a subfolder of the public static HTML of the Jinja 2 theme, except the fact that it might break relative links (?).
For the Jekyll or Wordpress site, I'd like it hosted under a slash of the domain and not a subdomain. How would you approach that?
Thank you for suggesting fixes and various creative ways to approach the problem. If that can be solved simply with the existing Flask and Jinja 2 code, that'd be cool. Or by using strange DNS tricks considering I'm already set up with the hosting of each subsites.
I expect to have relative HTML links errors, however. How should I prepare agains that, too, or automatically fix each link?
I suggest adding a CNAME dns record that can point https://www.neuraxle.neuraxio.com/stable/index.html
to
https://www.neuraxio.com/neuraxle/stable/index.html
This is pretty easy to do thats why I would have just gave you a link if I could but I will write a long answer instead :
1 - Log in to your DNS management service (GoDaddy.com, googlecloud dns service...) For my part, my website is hosted on google cloud DNS.
2- Click on your website.
3- Select Add a Record Set
4- Select CNAME record
5- I the DNS name form add https://www.neuraxle.neuraxio.com/
6- In the canonical name (the alias) add : https://www.neuraxio.com/neuraxle/
I wouldnt put this part /stable/index.html because your server should be abble to take care of pointing to it.
Hope this helps !

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 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 ?

extract price from different e-commerce site using python

I need to develop web app for extracting prices of books from different e-commerce sites like amazon,homeshop18 when user enters book name in the interface and displays all the information.
My questions are
1)how to pass that query to amazon site search box and i can get only the pages relevant to the query instead of crawling the whole site.
2)What can be used to develop this application?BeautifulSoup or scrappy?API's are not available for all e-commerce sites to use it
am new to python.so any help will be highly appreciated
I personnaly use BeautifulSoup to parse web pages, but beware it's a bit slow if you have to parse pages massively. I know that lxml is faster but a bit less coder-friendly.To guess the right parameters (either for an HTTP GET or POST) for getting the result page you want, you should proceed like this:
Switch on the firebug plugin for Firefox or the integrated inspector for Chrome
Go on the web page you're interested in, and do the search
Go into firebug/inspector to see the parameters of the HTTP request Firefox or Chrome sent to the website.
Reproduce the request in your python script. For example using urllib
There is another way to guess the right HTTP GET or POST parameters, it's to use a network analyzer like Wireshark. This is a more detailed approach but feels more like
finding a needle in a haystack once you used the tools in Firefox/Chrome.

python open web page and get source code

We have developed a web based application, with user login etc, and we developed a python application that have to get some data on this page.
Is there any way to communicate python and system default browser ?
Our main goal is to open a webpage, with system browser, and get the HTML source code from it ? We tried with python webbrowser, opened web page succesfully, but could not get source code, and tried with urllib2, in that case, i think we have to use system default browser's cookie etc, and i dont want to this, because of security.
https://pypi.python.org/pypi/selenium
You can try to use Selenium, he was done for testing, but nothing prevents you from using it for other purposes
If your web site is navigable without Javascript, then you could try Mechanize or zope.testbrowser. These tools offer a higher level API than urllib2, letting you do things like follow links on pages and fill out HTML forms.
This can be helpful in navigating a site that uses cookie based authentication with HTML forms for login, for example.
Have a look at the nltk module---they have some utilities for looking at web pages and getting text. There's also BeautifulSoup, which is a bit more elaborate. I'm currently using both to scrape web pages for a learning algorithm---they're pretty widely used modules, so that means you can find lots of hints here :)

Categories

Resources