I am creating a Python application that uses multiple third party libraries. Since the libraries are installed on my computer, the script runs fine. However, how can I alter my script so that it will run on any computer (all major OS), even if the computer does not have the third party Python libraries installed?
By your comment:
I want the script to stay a python script if at all possible so that
it can be run on any device and run through a webpage
It appears you want some way to host a python program online.
To do this, you need:
To know how to write Python that serves a website (see Django, Flask, CherryPy, etc...)
Some way to deploy said application to the web. An easy, free (<-- this is the keyword) way to deploy Python web apps is through using Heroku or some other free hosting site. Or you could always pay for hosting or host it yourself.
Related
My team and I have set up an account with Hostinger and have a VPS set up with its own domain. Our current Operating System is CentOS 7 64bit with Webmin/Virtualmin/LAMP and we have Webmin set up as our Cpanel. As of right now we have our HTML pages showing but our Python code is not working.
We used SSH to download Python3, MongoDB, pymongo, and flask, but are still having trouble getting our Python code to work on our web application. From here we are unsure what to do and need guidance on what our next steps should be. Thank you in advance for any help given.
It sounds like what you've gone for on your VPS is a web hosting setup rather than a bare metal VPS setup. I can see why you think you'd want web hosting, but in reality Flask works differently in that it is its own application which needs to run rather than being served like an HTML page.
There is an excellent tutorial on how to do this here. It is designed for Ubuntu (which is a good setup if you are starting fresh) but there are also versions for different linux flavours.
Forgive me, I'm new to all this. It might not even be possible?
I have a Dash app that does a number of calculations, and I need to deploy it locally somehow.
I need all users in our company to be able to view it, but without the dependencies of the packages. I cannot use any web-based (Heroku, Git, etc) method as the data is commercially sensitive and must remain site-only.
I can successfully run it through waitress-serve on my machine and it can be viewed on other computers, but I'd rather it run from the server and be accessible by anyone that wants to use it.
What's the solution? Is is possible to have a folder on the server that has all the associated files and dependencies, and then a batch file (or similar - that's what I use now to launch mine) to launch the app on a wsgi server? Would our network have to have the python dependencies installed however?
I've never worked with Django before so forgive me if a question sounds stupid.
I need to develop a web application, but I do not want to deploy it on a server. I need to package it, so that others would "install" it on their machine and run it. Why I want to do it this way? There are many reasons, which I don't want to go into right now. My question is: can I do it? If yes, then how?
This is possible. However, the client machine would need to be equipped with the correct technologies for this to work.
When you launch a web app on a server (live), the server is required to have certain settings and installs. For example, a Django web app: the server must have a version of Django installed.
Hence, whichever machine is running your web app, must have Django installed. It presumably also needs to have the database too. It might be quite a hassling process but it's possible.
Just like as a developer, you may have multiple users working on 1 project. So, they all need to have that project 'installed' on their devices so they can run it locally.
You need to either use a python to executable program, with Django already in it. The website files you can place into the dist folder or whatever folder has the executable in it. Then you can compress it and share it with others (who have the same OS as you).
For an example:
You have this script in Django (I'm too lazy to actually write one), and you want to share it with someone who doesn't have Python and Django on his/her computer.
I am making an app which will login to a website and scrape the website for the information I have. I currently have the all the login and web scraping written in Python completely done. What I am trying to figure out is running that python code in Xcode in my swift project. I want to avoid setting up a server capable of executing cgi scripts. Essentially the user will input their credentials and I will pass that to the python file, and the script will run.
Short answer: You don't.
There is no Python interpreter running on iOS, and Apple will likely neither provide nor allow one, since they don't allow you to deliver and run new code to in iOS app once it's installed. The code is supposed to be fixed at install time, and Python is an interpreted language.
I want to deploy my python application to my customers. Well, I basically don't know much about python application deployment, but my requirements/questions are
1) The user can install it as long as they can access internet. For mac applications, they are all hosted by apple app store. For chrome extensions, they are hosted by google. My question is, if there's a similar place that are hosting python applications, and it provides updating mechanism? If I have to do it on my own, is there any existing framework stuff for me to do it?
2) My application would be used to read USB device, and act as a http server. I want the install package to be as small as possible, and I also need to package python runtime. What is the package size that I should be expecting? 5M? 10M?
I have sucesfully used pyinstaller for my project
https://github.com/pyinstaller/pyinstaller/wiki
My application is reasonably large, so the installer package is around 100MB which compresses to 60MB. A lot of that is numpy, qt, scipy, and matplotlib.
We use a script to invoke pyinstaller which packages our main script and dependencies into a .app file. https://github.com/Erotemic/ibeis/blob/next/installers.py
If you are installing on a mac, this script in my repo will take a pyinstaller package and bundle it into a dmg.
https://github.com/Erotemic/ibeis/blob/next/_scripts/mac_dmg_builder.sh
If you host your program on your own server you can integrate an auto-update mechanism, but I don't know how to do that exactly. I just host my installers on dropbox.