· 

PythonAnywhere: How to upload a file

1. Introduction

I am working on PythonAnywhere, which is in the cloud.  I want to use an image file as a static file, so I need to upload the file to my site on PythonAnywhere.  How can I do this?

 

2. Use the File tab

I want to upload my image file to ~/django_projects/mysite on Pythonanywhere.  How can I do it?

 

Good question 👍 On PythonAnywhere, you don’t directly drag-and-drop files into your project folder from your computer — you need to upload them through their interface or with a command.

Here are the main ways:


1. Upload via the PythonAnywhere file browser (easiest)

  1. Log in to your PythonAnywhere dashboard.

  2. Go to the "Files" tab.

  3. Navigate to your project folder (in your case: ~/django_projects/mysite/).

  4. Click the Upload a file button (top right).

  5. Select your image from your computer and upload it.

Now your image will be in ~/django_projects/mysite/.


2. Upload via Bash console

If you have your image on your computer, you can use scp (secure copy) or rsync from your local terminal to upload directly to PythonAnywhere.

For example (replace <username> with your PythonAnywhere username):

scp myimage.png <username>@ssh.pythonanywhere.com:~/django_projects/mysite/

This requires that you have SSH access enabled on PythonAnywhere.


3. Upload via Git (recommended if your project is under version control)

If you’re using GitHub for your Django project:

  1. Add the image to your local project (e.g. polls/static/polls/images/myimage.png).

  2. Commit and push to GitHub:

    git add polls/static/polls/images/myimage.png
    git commit -m "Add background image"
    git push
  3. On PythonAnywhere, pull the changes:

    cd ~/django_projects/mysite/
    git pull

This way, your code and static files stay in sync.


Best option for you right now: Use the Files tab upload (method 1) — it’s simple, no command line needed.


 

Do you want me to show you exactly which subfolder in ~/django_projects/mysite/ you should put your image, so Django’s {% static %} can find it?