2

I uploaded my app that worked fine on my local machine to pythonanywhere. I got it to work but instead of showing the homepage of my blog it shows the "It worked, welcome to Django" page. Could someone please help me?

2 Answers 2

2

the two main stumbling blocks for people uploading apps to PythonAnywhere tend to be getting the correct version of django, and getting the WSGI configuration right.

For the former, we recommend using a virtualenv. There's a detailed how-to guide here: https://www.pythonanywhere.com/wiki/Virtualenvs

For the wsgi file, there's a detailed guide to getting imports correct here: https://www.pythonanywhere.com/wiki/DebuggingImportError

Sign up to request clarification or add additional context in comments.

Comments

0

OK I got it. Here's what I did:


1) If the Django shells insist on prepending 'magula4' to the model name, why not prepend magula4 to the table name when I create the table? Click on mesas676$magula4 database on pythonanywhere Databases tab:

mysql> CREATE TABLE mesas676$magula4.cw_operator (id INT, name CHAR(255), slug CHAR(255));
mysql> INSERT INTO mesas676$magula4.cw_operator (id,name,slug) VALUES(4255,'ARMER M B', 'armermb');
mysql> SELECT * FROM mesas676$magula4.cw_operator;

| id   | name            | slug          |
| 4255 | ARMER M B       | armermb       |

2) ALTER TABLE as needed until you have all the fields that are in the Django model e.g.:

mysql> ALTER TABLE mesas676$magula4.cw_operator ADD COLUMN wells BOOLEAN;

3) change Django DATABASES settings to magula4:

DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'NAME': 'mesas676$magula4', 'USER': 'mesas676', 'PASSWORD' : bigsecretR5%t*', 'HOST': 'mesas676.mysql.pythonanywhere-services.com', 'PORT': '3306', } }

4) Django shell:

`$ ./manage.py shell
In [4]: from cw.models import *
In [5]: o=Operator.objects.get(id=4255)
In [6]: o.name
Out [14]: 'ARMER M B'`

hurrah!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.