PythonAnywhere Forums

How to load existing Django project, from my computer?

How I can load project (ex. C:\Django\myproject) from my computer to hosting?

Hi there, I can think of 3 different ways:

1 Use a source control system like git, with a service like github.

Sign up for an account on github, and install git on your pc. Github have great instructions for beginners. Once you've got your Django project sync'd up to github, you can use git inside a bash shell on pythonanywhere to "clone" your repo and sync it down to pythonanywhere as well. This gives you a nice controlled way to make changes, and do dev work on either pythonanywhere or your own pc. Instead of git+github, you could look at mercurial+bitbucket if you prefer, some people say mercurial is easier to learn.... I'd say this is the "rigorous" software development approach, and if you''ve never used source control before, it's a good thing to learn! But, it is a bit heavyweight. So, instead you could try:

2 Use Dropbox.

If you have a Dropbox account, move your django project into a folder in your dropbox. Then, share that folder with us (you'll find instructions on the Files tab) and you'll have your project sync'd automatically between your PC and PythonAnywhere.

3 Upload a zip file.

Compress your Django project into a zip file - you can right-click it in windows explore and click compress - then, upload the compressed file via the Files tab to your home folder on pythonanywhere. Once it's there, you can use a Bash shell to

unzip my_compressed_django_project.zip

That's quick and easy, the disadvantage is that there's no easy way to keep changes in sync between your pc and pythonanywhere.

In all cases, you'll then need to setup your wsgi file to start serving your app. If you got to the Web tab, then click *Existing apps and other WSGI frameworks", you'll find a link to edit your WSGI file. If you look through the comments in there, you'll find instructions on how to configure a django project....

I'm here if you need any more help! Let us know which solution you go for, or if you have any more questions...

As a kind of Option 1a:

If you have a paid for PythonAnywhere account you can use git over ssh to push straight to PythonAnywhere from your local machine. This means you don't have to pay for a github account. Also if you have a paid for account you can just use scp. Which is a secure copy command which also runs over ssh.

Hi, I used Option 3 but I'm getting an error: End-of-central directory signature not found

That sounds like the zip file got corrupted somehow. Perhaps it's worth trying to upload it again, and then try again?

Hello Please, I have a project that I have hosted on Pythonanywhere via github but I've made new updates on my local machine and pushed it to git. I want to know how I can sync the updates via github with the project I've already hosted on Pythonanywhere. Thanks.

You would pull the changes from github into your PythonAnywhere repo and reload the web app.

Okay thanks for the help glenn :)

Hi glenn, I made some changes to my project from my github account and I want to sync it to my pythonanywhere project. But again, I've made some changes on my pythonanywhere project that are not available in my github account. How do I merge both so to say, get the current datas from my pythonanywhere project onto github and then merge the changes and push back to pythonanywhere without losing anything. Thanks

What you need to do is commit the changes inside PythonAnywhere, then do a git pull. Git will try to merge the changes together, and will give you errors if it's impossible (eg. if you've made changes on GitHub to the same lines as you have on PythonAnywhere). It's pretty smart about merging, so unless you've done something really crazy, it should work fine :-)

It's well worth taking some time to go through a git tutorial, BTW. GitHub have some great ones here, and if your the kind of person who likes to know the low-level details, Git Immersion is awesome.

I uploaded the zip file and I giving the appropriate command to unzip yet, but it I keep getting the error 'cannot find or open' the said file. I'm not sure how to tackle this.

Are you sure you're in the correct directory when you're running the command?

I uploaded the zip file and also unzipped it successfully, now the question is how to get it running ?

You could also use SFTP to upload files, by the way, which saves the zip/unzip steps.

@jgmdavies -- SFTP only works with paid accounts, so @mak can't use it.

@mak -- there are help pages here that should cover everything.

Ah, sorry - what better reason to upgrade?! ;---)

:-)

hey i tried option 3, but got an error "disallowed host", i even tried adding the web address to allowed hosts

is this disallowed host a django error when you are trying to access the site?

yes!, but i managed to do it somehow, thank you :)