git pullfor this
manage.py createsuperuserfor this.
runservertakes care of static files, but servers like to manage things differently in order to optimise serving static files. Here we'll use a new command called
collectstatic, and configure the static files through PythonAnywhere's Web tab.
Note PythonAnywhere is based on Linux, so if you're on Windows, the console will look a little different from the one on your computer.
mkvirtualenvcomes from a tool called "virtualenvwrapper", which PythonAnywhere recommends. It's a set of shortcuts built around the normal
virtualenvcommand that you've already learned about using on your own computer.
deactivate, just like on your computer, but to activate we use the virtualenvwrapper shortcut command
workon, which just needs the name of your virtualenv:
pip installstep can take a couple of minutes. Patience, patience! But if it takes more than five minutes, something is wrong. Ask your coach.
workoncommand to activate your virtualenv).
collecstatic, whose job it is to collect all the static files from your apps (including apps you've written like blog, and built-in Django apps like the admin), and put them in one place, so the server can find them:
Note Make sure you choose the "Manual configuration" option, not the "Django" one. We're too cool for the default PythonAnywhere Django setup. ;-)
/home/<your-PythonAnywhere-username>/my-first-blog/myvenv/. Click the blue box with the checkmark to save the path before moving on.
Note Substitute your own PythonAnywhere username as appropriate. If you make a mistake, PythonAnywhere will show you a little warning.
/static/are all located in a file inside your source code folder called static. We do that in the "Static Files" section on the Web tab.
/static/, and click the blue checkbox to save. Then click the text that says "Enter path", and enter
/home/<your-pythonanywhere-username>/<your-pythonanywhere-username.pythonanywhere.com/static(using your own username, as usual):
/var/www/<your-PythonAnywhere-username>_pythonanywhere_com_wsgi.py), and you'll be taken to an editor.
Note As always, substitute your own PythonAnywhere username in this file.