Using our file API

Our API supports lots of common PythonAnywhere operations, like creating and managing consoles, scheduled and always-on tasks, and websites. We recently added support for reading/writing files; this blog post gives a brief overview of how you can use it to do that.

Read more…

System update on 26 June

Our system update on 26 June went pretty smoothly :-) There were a number of useful changes:

  • Our API now supports uploading, downloading and listing files in your private file storage. There is another blog post about this.
  • We now have an official system in place to migrate your MySQL data between database servers, which means that if you’re on an older version, we can move you over to 5.7. Let us know if you’re interested!
  • Our system for migrating user accounts from our US-based system at www.pythonanywhere.com to our EU-based one at eu.pythonanywhere.com is almost finished – just a few final bugs to work out. We’ll post about this again when it’s ready to go live. Update: it’s now live.

We also pushed a number of bugfixes:

  • A number of issues which meant that always-on tasks could lose access to the network have been fixed.
  • Previously, if you tried to change the command for an always-on task that was disabled, you’d get an error – this has been addressed.
  • Some HTTP libraries (which seem particularly common on IoT devices) put the port number in the host header on requests (eg. they send www.somedomain.com:80 rather than www.somedomain.com). This is perfectly valid HTTP, albeit uncommon, but our system failed to parse them correctly and would respond with a 404 error. We’ve fixed that.

There were also a whole bunch of minor UI tweaks and the like.

Right now we’re working on making sure that our billing system supports the Strong Customer Authentication (SCA) regulations that will come into force for all payments from European credit/debit cards this September; hopefully we can make this as seamless as possible for you.

Happy coding!

Using MongoDB on PythonAnywhere with MongoDB Atlas

This requires a paid PythonAnywhere account

Lots of people want to use MongoDB with PythonAnywhere; we don’t have support for it built in to the system, but it’s actually pretty easy to use with a database provided by MongoDB Atlas – and as Atlas is a cloud service provided by Mongo’s creators, it’s probably a good option anyway :-)

If you’re experienced with MongoDB and Atlas, then our help page has all of the details you need for connecting to them from our systems.

But if you’d just like to dip your toe in the water and find out what all of this MongoDB stuff is about, this blog post explains step-by-step how to get started so that you can try it out.

Read more…

System update this morning

This morning’s system update went smoothly :-)

It was primarily a maintenance update, bringing our US-based system up to the same version as our EU-based system. There were a number of minor bugfixes, along with a bunch of improvements to our system administration tools, which won’t be visible to you, but do mean that we’ll be able to spend less time on admin stuff – which gives us more time to work on adding cool new features!

Announcing eu.pythonanywhere.com

We’re proud to announce today that we now have an EU-hosted PythonAnywhere system :-) You can access it at eu.pythonanywhere.com. It’s completely separated from our normal system, but has all of the same features – plus billing in euros.

Read more…

How DNS works: a beginner's guide

The blog post below has now been “promoted” to being an official help page – you can read the most current version here. The version below is the original published version and may be out of date.

We sometimes get emails from people who are trying to point their custom domain at PythonAnywhere so that they can host their website, but are struggling to set up their DNS settings. Normally DNS setup is pretty simple, but sometimes people can get bogged down due to confusing interfaces on their registrar’s site, or complexities in the terminology people use.

The parts of DNS that you need to know about in order to host a website are actually not all that complicated, but some domain registrars have complicated, hard-to-understand interfaces. Either they assume that you understand all of the technical details about how the whole thing works – which makes it hard for first-timers – or they try to put a simple user-friendly interface on top of it, but simplify it so much that it’s actually harder to use because they’re hiding important stuff from you.

Given that basic DNS stuff really isn’t all that hard, we felt that it would be a good idea to post an explanation, going from the basics up to some slightly deeper stuff. This post is written so that if you only want the basics, you can just read the first part, while if you want a deeper understanding – either out of interest, or because your domain registrar has got such a low-level interface that you need to – then you can keep reading.

It’s worth noting that for most people, you don’t need to know any of this stuff to set up a website on PythonAnywhere, even with a custom domain; it’s meant more as an explanation so that people who do run into problems with their registrar have the background knowledge they need to solve the problem – or, indeed, to explain to the registrar’s tech support team what the problem is. And, of course, it’s a bit of light reading for people who are just interested in this stuff :-)

Read more…

Slow scheduled tasks after yesterday's system update

After our system update yesterday, there was a period when some people’s scheduled tasks were running slowly. This is an update on what caused the issue and what we did to fix it.

Read more…

Today's upgrade: Let's Encrypt auto-renew and much much more!

This morning’s system update went pretty smoothly, and we have some cool new stuff to announce:

Let’s Encrypt certificates with automatic renewal

You can now get an HTTPS certificate for your custom domain using Let’s Encrypt without all that tedious mucking around with dehydrated – and you don’t need to remember to renew the certificate either, or even set up a scheduled task to renew your certificate for you.

Just go to the new “HTTPS certificate” line in the “Security” section of the “Web” tab. You’ll see a pencil icon next to the kind of certificate you have (which will probably be “None” or “Custom”). Click the pencil, and you’ll see that there’s an option called “Auto-renewed Let’s Encrypt certificate”. If you select that and click “Save”, we’ll get a fresh certificate for your site from Let’s Encrypt – and well before it expires, our system will automatically renew it for you.

If you have a certificate that you’ve bought from some other organisation like Comodo or GoDaddy, you can also configure it from here – select the “Custom certificate” option, and you’ll get input fields where you can copy and paste the private key and the combined certificate.

We have detailed instructions with screenshots on the help site.

The old ways of setting up a certificate still work – you can use dehydrated, or get a certificate from a third party like GoDaddy, and upload everything using the command-line scripts.

MySQL 5.7

New accounts created from today will use MySQL 5.7. If you’re still on 5.6 and would like your databases moved over to a 5.7-compatible server, get in touch over support@pythonanywhere.com – the move won’t happen until early next year, though.

Fixes for Firefox and Selenium from website code

Several people reported a problem where you could not run Selenium from website code from a Hacker account – you needed a Web Dev account or better. This was a bug, not a feature, so we fixed it :-)

CPU sharing enhancements

There was a problem where people who had used all of their CPU allowance could continue to use lots of server resources; this isn’t something that would have been useful for anyone or that we think anyone was doing deliberately – it would only happen if they started processes which did nothing and then restarted. So it just meant that if one person had a certain kind of bug in their code and then went into the tarpit, they’d use up CPU that could have been put to better use by people who were actually trying to run working code :-) We’ve put a fix in place to stop that from happening.

And that’s it!

Of course, there were the normal minor tweaks and bugfixes, but those are the highlights. A very happy holiday season to everyone, and we look forward to being able to show you some cool new stuff in the new year!

Always-on tasks

Always-on tasks are a new feature we rolled out in our last system update. Essentially, they’re a way you can specify a program and tell us that you want us to keep it running all the time. If it exits for any reason, we’ll automatically restart it – and even in extreme circumstances, for instance if the server that it’s running on has a hardware failure, it will fail over to a working machine quickly.

Read more…

Today's Upgrades: Always-On Tasks

Always-On Tasks

We are officially live with our always-on tasks! All paying customers will get one always-on task, and you can add more by customizing your plan on our accounts page. Our infrastructure will try to keep your script always running (ie. we will restart it if your script errors and stops etc). We’d love to know what you think- Just drop us a line using the “Feedback” link, or email us at support@pythonanywhere.com!

Logging Improvements

We have also improved user experience working with log files. You can now access our API to delete log files (or wipe the file if your particular log file is currently in use), and we have better formatting in place when logging certain web app errors.

Other Stuff

We also optimized the editor that you can access from the ‘Files’ tab to make consoles within it start faster and to avoid scripts rerunning unintentionally.