Synchronize python files between my development computer and my raspberry - python

I am writing a web python application with tornado framework on a raspberry pi.
What i actually do is to connect to my raspberry with ssh. I am writing my source code with vi, on the raspberry.
What i want to do is to write source code on my development computer but i do not know how to synchronize (transfer) this source code to raspberry.
It is possible to do that with ftp for example but i will have to do something manual.
I am looking for a system where i can press F5 on my IDE and this IDE will transfer modified source files. Do you know how can i do that ?
Thanks

Some IDEs like JetBrains PyCharm are supporting automatically file upload via ssh/scp/ftp.

Following a couple of bad experiences where I lost code which was only on my Pi's SD card, I now run WinSCP on my laptop, and edit files from Pi on my laptop, they open in Notepad++ and WinSCP automatically saves edits to Pi. And also I can use WinSCP folder sync feature to copy contents of SD card folder to my latop. Not perfect, but better what I was doing before

I have done this before using bitbucket as a standard repository and it is not too bad. If you set up cron scripts to git pull it's almost like continuous integration.

Related

Use Jupyter to run remotely without coping file(other than script) on remote computer

With the lockdown going on, I work on my professional laptop to run Machine Learning models. Sadly, this laptop is not very powerful.
Since I have a powerful machine at home, I wish to use it's power. I know it is possible, but the solution shown implies to copy files on the remote computer. I have restriction from my company that doesn't allow me to do so for security reasons.
Is there a way to still manage to use my home computer resources to run my code ?
Thanks in advance,
I do the same thing without copying the data using WinSCP. It's Data manager with GUI which works very similar to PUTTY. With this you can live synchronize folders in both machines, edit the files on your machine and test on the other. But for this trick you will need both Pycharm and Jupyter. Pycharm for editting functions with WinSCP and jupyter for testing the functions. I hope it helps.

Using python to copy files from/to raspberri pi

I'm writing a python script running on a NAS and picking up files from inside of a raspberry pi.
Didn't find any examples how to access raspberry pi.
Can somebody give advice?
Thank you
Please do more research.
The easiest way is probably to run Secure Copy (SCP) over SSH from python on NAS. See this thread
If you want to serve files to other clients (e.g. your laptop), consider running file server on RPI. Perhaps FTP: FTP on RPI tutorial
Otherwise you can implement HTTP like interface (REST API for example) and "get" files via HTTP. Don't skim on the security and access rights to your API.

Using a python webserver

I am looking for a web server, where I can upload files and download files from Ubuntu to Windows and the vice versa. I've builded a web server with Python and I share my folder in Ubuntu and download the files in this folder at Windows. Now I want to look up every millisecond if there is a new file and download this new files automatically. Is there any script or something helpfully for me?
Is a python web server a good solution?
There are many ways to synchronise folders, even remote.
If you need to stick with the python server approach for some reason, look for file system events libraries to trigger your upload code (for example watchdog).
But if not, it may be simpler to use tools like rsync + inotify, or simply lsync.
Good luck!
Edit: I just realized you want linux->windows sync, not the other way around, so since you don't have ssh server on the target (windows), rsync and lsync will not work for you, you probably need smbclient. In python, consider pysmbc or PySmbClient

Apache: How to set default document to a python script?

I have apache running on a Raspberry Pi. My website is using running Python scripts. How do I make, say, start.py, as the default document for the site? In other words, if the host name for the Raspberry Pi is pi, I want my users to just use http://pi and start.py will execute.
I would use apache's mod_fastcgi module, mapping a virtual host in apache to a script folder containing python scripts. Note however, this is far from production quality, or secure! However, if your Pi is on a trusted intranet network such as a home, it should be fine.
Here's one blog which spells it out, step by step: http://raspberryserver.blogspot.com/. The final step in the tutorial is to install apc, which you can skip. It's for PHP.
Essentially, you'll be able to drop python files into the /var/www/fastcgi folder, and profit.

System requirement for an embedded Python web server

I'm working on an embedded device that runs Linux on ARM7 with 64MB RAM and 64MB storage (12MB free). The device should be configured via web therefore it needs to run an embedded web server. Currently it's using Lighttpd and LUA, but I'm thinking about replacing LUA (or maybe even Lighttpd) with Python. The server will occasionally be accessed by one or two users for making changes to internal settings of the C program that is running in Linux. So the server load isn't really a lot. I also need it to be Open Source Software. Web.py seems to be small enough but I still need to compile Python which I haven't done before. So I'm wondering what are the system requirements of Python? LUA seems to do quite well for small embedded systems but I don't like its syntax for C-binding.
However, I couldn't find updated information about system requirements for embedding Python in such settings. This page from Michael Lauer seems to be old.
Any ideas? Suggestions? hints? links?
I'm working on this device using OpenWRT + Python:
http://wiki.openwrt.org/oldwiki/OpenWrtDocs/Hardware/Meraki/Mini
The first python run is veeeeeery slow but it are metacompiling all .pyc files, next it work well.

Categories