Forums

I'm so confused when trying to upload my Django project.

I have my django project, and I upload it via files to the project. What next? I don't know anything about wsgi... i have not learned any of this. my thing is a complete django project not just one single app

I think you should find WEB option on menu and click Add a new web app which is on the left. Once web app is created you can add some code by upload but don't expect just to upload and that's it. I'll help you if you want.

Hi there, you might find this guide useful:

https://help.pythonanywhere.com/pages/VirtualEnvForNewerDjango

It's written assuming you are starting a brand new django app, but if, instead of doing the "starproject" step, you just make a note of the path to your existing django project, and use it when following the instructions to edit your wsgi file, then you should be fine.

You might also find this step-by-step guide useful -- it's high-level, but the main steps are there:

http://www.pythonanywhere.com/task_helpers/start/4-deploy-local-web-app

OK, I've just written a guide aimed specifically at "how to deploy an existing django project on pythonanywhere" -- let me know if it's useful?

If you have feedback or suggestions for improvement for the documentation, let me know that too...

Do I need to create a virtualenv if I already have one on my computer?

yes. virtualenv's are specific to and local to computers.

@RafalSzymanski thanks! :D

I couldn't understand "virtualenv" for a while and now I would put it in this way: When you want to create some django project with some additional tools (for example selenium) and you want to use newest version of django and tools you have to create some space for all of this. You create virtualenv for this project install newest django, newest selenium and other tools inside this virtualenv. When you would like to start another great project in a 6 months there will be probably newest versions of django and tools. Then you can create another spece for new project and install newest versions of django and other tools. If you would create new django project in next week there probably won't be new versions so you can use virtualenv you created last week with latest django installed already.

yup. sounds right! basically virtualenvs are there for the local computer to have specific version of django/selenium etc installed, and so that your different projects can use different versions of the packages on the same computer.

Ok, thanks conrad! If I already have a project but its in a slightly different format than you mentioned (settings.py is at /project/src/project) can I just make a virtualenv in /project and then it will all work?

so i have the virtualenv installed in /project, but for some reason my web app only loads the default. could you help me out in any way? also, for databases can i use sqlite? I think that's what u usually use for django, no?

It's not like that If I could put my 3 cents. You don't create virtualenv in /project directory. Virtualenv is something like rules. Different projects can work under different rules. You have to say to your computer which rules has he apply to run specific project. For example you have 3 project: A, B and C. Project A is build upon Django 1.7, porject B is bulit upon Django 1.9, and project C is build upon Django 1.9 (just like project B). Your computer has to know which version of Django to run for which project. You have to tell him that for project A he need to use Django 1.7, and for projects B and C he need to use Django 1.9. You don't have to tell it him every time he runs project. Tell him once. In human languge it would be "remember old pal, when I work over project A you have to run Django 1.7, and when I work on projects B and C you need to use Django 1.9". Old computers would understand what you say, but new ones won't so you have to do it in different way - you have to create two different virtualenvs and write some instruction that computer will know exactly what has he do and when. Then you can has different directories in different project. It doesn't matter. Did I help a bit?

Would it be possible for someone to Skype me 10 minutes just to go through how to do this?

Which bit are you having trouble with? There is extensive documentation on the help site about creating and using virtualenvs on PythonAnywhere and there is more general help all over the internet about virtualenvs in general.

Where exactly do i create the virtualenv? None of these guides have the same project setup as I do... my settings.py is in /project/src/project, while everything here has it in /project/project

Where you put the virtualenv is generally entirely up to you. However, it's a good idea not to put it in with your source code. If you use virtualenvwrapper, the virtualenv will be create in ~/.virtualenvs

ok, but my project is in a completely different form from what your tutorials talk about

my settings.py is in /project/src/project

then you need:

  • sys.path.append("/project/src")
  • DJANGO_SETTINGS_MODULE = "project.settings"