Whether it's uploading your code once and for ever, or downloading your code to move somewhere else, or trying to keep your local dev environment in sync with PythonAnywhere, we're keen to help you get code in and out. Try out the solutions below, and remember we're always here to help! The "Send feedback" button is just a short click away...
The file upload button
If you just want to upload one file, and it's smaller than 100MiB in size, you can just upload it on the "Files" page -- look for the orange button. Similarly, your can download files using the button next to the filename.
This is useful for quick updates, but less good if you want to transfer multiple files -- for example, all of the code for a website.
Using a code sharing site like GitHub or BitBucket
The very best way to manage your code files is to use a source code control system (or VCS) like Git, Mercurial or Subversion. You can then "push" your code up to GitHub or Bitbucket, and then "pull" it down to PythonAnywhere, or push from PythonAnywhere to Bitbucket or GitHub. You also get all the benefits of using a version control system, the ability to go back to older versions of files, etc.
On PythonAnywhere, use a Bash Console, and you'll be able to access
svn) and clone your repository, and push
and pull. You can also generate an SSH keypair using
Uploading a zip file
The alternative is to compress your project folder on your own PC, and upload
it using the Files tab. Then, open a Bash console to run
decompress the zipfile you've uploaded.
If your file is too large to upload -- that is, more than 200MiB, you may have to split it up into chunks and stitch them back together afterwards. Split the files locally into 50mb files:
split -b 50m huge_file
Upload them to PythonAnywhere, then get them back together with:
cat file1 file2 file3 > huge_file_on_pythonanywhere
The process for downloading multiple files is just the same, but in reverse.
SFTP (paying accounts only)
If you have a paid account, you can use SFTP, which is a form of FTP-over-SSH. Use your normal username and password and connect to ssh.pythonanywhere.com.
From the command-line, use
Filezilla also supports SFTP; just use
ssh.pythonanywhere.com as the server
(if you're entering it into the box at the top of the main screen, you'll need
to specify SFTP there too, like this:
NOTE: If your
.bashrc outputs anything to the console when you connect,
the SFTP connection will not work. SFTP from the command line will give you an
error like this:
Received message too long 1651664225 and Filezilla will give
an error like
Connection timed out after 20 seconds of inactivity.
Rsync (paying accounts only)
Paid accounts can also use the
rsync command; run the following command on your local machine:
rsync -avzhe ssh <LOCAL_FILE_PATH> <USER_NAME>@ssh.pythonanywhere.com:<DESTINATION_DIRECTORY>
To grab a file (or directories) from your pythonanywhere account to your local machine, run the following from your local machine:
rsync -avzhe ssh <USER_NAME>@ssh.pythonanywhere.com:<PYTHONANYWHERE_FILE_PATH> <LOCAL_DIRECTORY>
If you have a another server somewhere, you could also rsync between that and PythonAnywhere. PythonAnywhere will only listen to port 22, but to configure your own server to listen on say 2220 or whatever port for an incoming ssh connection:
rsync -ravzhe 'ssh -p 2220' <DIR_PATH_ON_PYTHONANYWHERE> <USER_NAME>@<YOUR_SERVER>:<DESTINATION_PATH>