Forums

Zero command line deployment

Hello,

I'm trying to write a tutorial for Python beginers on my blog (4000 users/day), espacially windows users, with no command line involved.

I'd like to recommand the free (no ssh) PythonAnywhere offer as a noob host, but right now I'm stuck.

I can get them to upload the zipped project to the host, but there is no way to unzip it without using the console.

I can't tell them to upload all files manually one by one, particularly since the tutorial embed dependcies in the project to avoid using pip (not that I don't love pip, but the goal is zero cli).

I could write a script uploading their project with a GUI, but the only way to do that in pure Python would be to POST data to your upload form for all files. Managing the CSRF cookie and the session ID is going to more work, plus it's a lots of requests and will break if you change your HTTP API. I could hack it by just uploading the zip, then post a script as a cron task to unzip it, but now it's getting ridiculous.

Bottom line, I'm stuck : do you have a solution for me ?

@sametmax How ere you envisaging your pupils would run the project?

Maybe from the Files tab (click on a Python source file, then you have a Save & Run button at top right (make sure popups are enabled in your browser), or is it a web app?

Just wondering...

Jim

It's a Web app.

On the destop, they just have to clic on the script.

On PA, you have this wonderful app wizard. I will just make sure my dir structure match you default app structure, make them create a flask app, upload their project to erase the hello world files you provided, and it should work, since your WSGI file is already setup to run it out of the box and conveniently import "app" and alias it as "application".

Hi sametmax -- I can't think of a good solution for this without using the command line; even if we supported uploading multiple files at once, I don't think we'd be able to upload directories.

On the other hand, anyone who does learn to program will have to learn a command line at some point -- would three bullet points saying

  • Go to the "Consoles" page and click the "Bash" link
  • In the page that appears, type "unzip uploadedfile.zip" and hit return
  • Type "exit"

...be so bad?

No it's not.

It's just marketting.

Zero command line Web Python programming doesn't have the same ring as "Only one command Web Python programming".

One of the biggest stuff the puts off PHP users from Python (technically, EasyPHP users) is CLI. You can always lure them away to use it later. But I'd love to be able to find a way to make them start without it.

I'm basically trying to answer to this complain I here all the time about how easy it is to put a PHP site online (just copy/paste files in /var/www/root) but in Python/JS/Ruby it's hard.

Now, if I can't, I'll go with one command line. It's still a great improvement.

Anyway, if you ever feel like adding an "unzip" button to your file explorer :))))

Another alternative I'm thinking about it to make a script that turns the project into an .egg and upload that. But I will need to make some special setup for the static files, and it's very different from usual deployment which is not great.

I see what you mean about the marketing.

Hmm, we definitely want to add some improvements to our files page soon. I'll make sure that's on the list.

In any case, thanks for anwsering tickets like that. It's great CS.

No problem :-) And thanks for the suggestion!

@sametmax: How about using an FTP client to upload a whole folder (tree) instead?

Jim

Hi,

That would be my preferred option but SSH is only available on paid instance of PA. I'm targetting PHP coders with plenty of easy free hosting solutions as alternatives, so I can't tell them to pay $5 off the bat to deploy their toy app.

In the end, however, they always end up paying something. But I can't tell them that.

Understood.

I suppose the simplest solution then would be if PA enhanced the Files page to allow uploading of a folder (tree). Not trivial, but maybe they could consider it for the Wish List?

I'm guessing running PA is a hell of a job, so I'm not counting of new features being implemented just for my little experiment.

But it's nice that the forum is this reactive to input.

Yep, great eco system here! Makes all the difference.

I would definitely be +1 for that Files feature, as it can be an irritation to have to open a Bash shell just to do one 'unzip', and I'm doing it quite often.

OK, two +1s for an unzip option in the file browser -- thanks! We're planning a series of upgrades to the browser soon, and that should be a nice simple one.

Thanks Giles.

I think you misread me slightly: actually I'm +1 for enhancing the file browser to allow uploading of a folder (tree) (NOT a zip file - the user would simply select files and/or folders locally, and they would all be uploaded and copied to the user's tree on PA as appropriate), and also +1 for an 'unzip' button to apply to an uploaded zip file - 2 different enhancements?

;----)

Hi jgmdavies -- fair enough, two +1s. Uploading whole directories without using zip would be hard, though -- I don't think HTML file upload inputs allow that. Multiple files at the same level of the directory hierarchy might work, but probably not recursively going down the directories.

Yes, I was wondering if/how it could be implemented!

No problem here as I can use a Windows FTP client with my paid a/c to achieve the same result, so actually I don't need that enhancement myself - just thought it might help the OP.

Best idea I've had is to cheat - would there be a way you could allow use of SSH for free accounts, but only to upload files from an FTP client? Then they could upload one or more files or folders in one go.

Jim