Connecting iOS app to Windows/Linux apps - python

Background:
I am just about to start development on an mobile and desktop app. They will both be connected to a local wifi network (no internet connection) and will need to communicate with one another. At the outset we are targeting iOS and Windows as the two platforms, with the intention of adding Linux, OSX, and Android support in that order. The desktop app will largely be a database server/notification center for receiving updates from the iOS apps and sending out the data to other iOS apps. There may be a front end to the desktop app, but we could also incorporate it into the iOS app if needed.
For the moment we just want the iOS app to automatically detect when it is on the same network as the server and then display the data that is sent by that server (bonjour like).
As far as I see it there are two paths we could take to implement this
Create a completely native app for each platform (Windows, Linux, OSX).
Pro: We like the ideas of having native apps for performance and ease of install.
Con: I know absolutely nothing about Windows or Linux development.
Create an app that is built using web technologies (probably python) and create an easy to use installer that will create a local server out of the desktop machine which the mobile apps can communicate with.
Pro: Most of the development would be cross-platform and the installer should be easy enough to port.
Con: If we do want to add a front-end to the server app it will not be platform native and would be using a css+html+javascript GUI.
Question:
My question is how would implement the connection between the iOS app and server app in each circumstance.
How would I receive and send notifications over a local network.
How could I connect to the server using NSURLConnection if it does not have a static ip?
I hope this is clear. If not please ask and I will clarify.
Update 09/06/2013
Hopefully this will clear things up. I need to have a desktop app that will manage a database, this app will connect to iOS devices on a local wireless network that is not connected to the internet. I can do this with either the http protocol (preferably with a flask app) or by using a direct socket connection between the apps and the server. My question is which of the above two choices is best? My preference would be for a web-based app using Python+Flask, but I would have no idea how to connect the iOS app to a flask app running on a local network with out a static ip. Any advice on this would be appreciated.

Without any details of the application or frameworks its hard to be more than vague and point you in the right direction. If you have already explored Bonjour/Zeroconf to connect the iPhone to the server, I'd keep looking down that path.
The first place to look is PyBonjour for how to broadcast the server from Python. Although there are a few issues in how to configure this on Windows vs. Mac vs. Linux, this will be slight. For example, for windows the user will need to install Bonjour for Windows, where as Linux users will need Avahi, but most of this can be setup durin install.
Secondly, look at the Bonjour documentation for iOS, which will be much easier as its all built into the system and APIs. From here both server and client are discoverable to each other.
The last issue is determining if you want the iPhone to connect to the server or vice versa, and how. These however are basic networking decisions that more or less subjective.
Since you've indicated a preference for web development, you could easily have the iPhone connect to the Flask server and retrieve details from the server using HTTP/HTML technologies.
With regards to notifications, unless a change in data by client A means that client B absolutely needs to know about the change in data, I would not worry. The next time client B connects to the server, the correct data can be push through at that point rather than worrying with notification services. If another client does need to know about a change, another solution may just be regular old email that advices them, and prompts them to open the app.

I would definitely suggest a webapp. And the answer to your questions are given below:
How would I receive and send notifications over a local network.
Use a REST based web service to communicate with the server.
You have to use polling to receive data:-(
How could I connect to the server using NSURLConnection if it does not have a static ip?
If possible configure a domain name in your network which points to server ip. (Configure local DHCP to give same IP to your server every time based on mac address!)
Have a IP Range and when the app starts, try to reach a specific URL and check if it is responding.
Ask the user to enter the server IP every time the app starts!

Related

make flask application work for certain perio similar to trail software

I'm currently developing flask application for a client and i want to give him/her to test it in there local machine. Issue is that i don't have internet connect or remote access in their system so I'm forced to add all source code i did to their system. i want to know is there a way i can give the client flask application without providing him/her with source code.
My objective is to make source code hidden of flask application whether it by executable file or have 30days for testing and after 30days application will automatically be deleted or disabled from their system it similar how trial application work.
If anyone can guide me into how can i make source code of flask hidden from client when i don't have any access to PC or internet that flask application is installed in

django , node js, php website hosting and domain information

I would like to about Django, node js, and PHP hosting along with MySQL database.
how can we host them online, please suggest to me some websites for that? can I host the Django website with MySQL on GoDaddy, Bluehost or do I need to use cloud services like AWS Azure, etc?
how to set up a domain for these websites.
what is the difference in hosting the website using
can you host these website on a Cpanel and is there any other way also to host
The choice is really yours, you can install all of them on a single VPS server which
should be powerful enough to run them and you need to configure your Nginx or Apache2 to access them on a proxy level or with a different subdomains, or you can host them on separate servers, when you will get the domain you need to point it to your server(s) or create a reverse proxy which in turn will reflect another domain. Platforms like Azure provide more control over DevOps. Cpanel is just a tool that allows you to have more simple the process of hosting a web site. Some platforms like Heroku make the hosting process much more easier, you just deploy your code and its running like a charm no need to configure anything or install certificates, the only downside is that when you would want to scale your app the resources are stupid expensive at Heroku. I would prefer a VPS server over all of these, because of more control and flexibility.

How to deploy flask GUI web application only locally with exe file?

I'd like to build a GUI for a few Python functions I've written that pull data from MS SQL Server. My boss wants me to share the magic of Python & SQL with the rest of the team, without them having to learn any coding.
I've decided to go down the route of using Flask to create a webapp and creating an executable file using pyinstaller. I'd like it to work similarly to Jupyter Notebook, where you click on the file and it opens the notebook in your browser.
I was able to hack together some code to get a working prototype of the GUI. The issue is I don't know how to deploy it. I need the GUI/Webapp to only run on the local computer for the user I sent the file to, and I don't want it accessible via the internet (because of proprietary company data, security issues, etc).
The only documentation I've been able to find for deploying Flask is going the routine route of a web server.
So the question is, can anyone provide any guidance on how to deploy my GUI WebApp so that it's only available to the user who has the file, and not on the world wide web?
Thank you!
So, a few assumptions-- since you're a business and you're rocking a SQLServer-- you likely have Active Directory, and the computers that you care to access this app are all hooked into that domain (so, in reality, you, or your system admin does have full control over those computers).
Also, the primary function of the app is to access a SQLServer to populate itself with data before doing something with that data. If you're deploying that app, I'm guessing you're probably also including the SQLServer login details along with it.
With that in mind, I would just serve the Flask app on the network on it's own machine (maybe even the SQLServer machine if you have the choice), and then either implement security within the app that feeds off AD to authenticate, or just have a simple user/pass authentication you can distribute to users. By default random computers online aren't going to be able to access that app unless you've set your firewalls to deliberately route WAN traffic to it.
That way, you control the Flask server-- updates only have to occur at one point, making development easier, and users simply have to open up a link in an email you send, or a shortcut you leave on their desktop.
Unfortunately, you do not have control over a give users computer.
You are using flask, so your application is a web application which will be exposing your data to some port. I believe the default flask port is 5000.
Regardless, if your user opens the given port in their firewall, and this is also open on whatever router you are connected to, then your application will be publicly visible.
There is nothing that you can do from your python application code to prevent this.
Having said all of that, if you are running on 5000, it is highly unlikely your user will have this port publicly exposed. If you are running on port 80 or 8080, then the chances are higher that you might be exposing something.
A follow up question would be where is the database your web app is connecting to? Is it also on your users machine? If not, and your web app can connect to it regardless of whose machine you run it on, I would be more concerned about your DB being publicly exposed.

How do I update my web app features in the linux server? web app is build with Python, Flask, uwsgi and server nginx

I am new to Python development. I am building a test Python app and already deployed into a web server and accessing it through public IP. Now I have updated the source(that is added some more models and templates), Now I want my public IP under port 80 should show updated code.
How do I do this?
if you have used any sort of version control, it's just commit and push/pull to the server.
if not, you have to copy the code, paste it in the server, restart the application and it work's with new code.
best approach is make a service, deploy the code with git version control, run the service and you are good to go. service will start automatically in case of system-restart and such.

Deploy python application

I am developing an application for managers that might be used in a large organisation. The app is improved and extended step by step on a frequent (irregular) basis. The app will have SQL connections to several databases and has a complex GUI.
What would you advise to deploy the app ?
Based on my current (limited) knowledge of apps in lager organisations I prefer a setup where the app runs on a server and the user uses a thin client via the web. I prefer not to use a webbrowser because of (possible)limitations of the user GUI. The user experience should be as if the app was running on his own laptop/pc/tablet(?)
What opensource solution would you advise ?
Thanks !
If possible, make the application run without any installation procedure, and provide it on a network share (e.g. with a fixed UNC path). You didn't specify the client operating system: if it's Windows, create an MSI that sets up something in the start menu that will still make the application launch from the network share.
With that approach, updates will be as simple as replacing the files on the file server - yet it will always run on the client.

Categories

Resources