Sunday, April 27, 2014

Django With Xampp and MySQL - Creating Tables, Models.py not working(Windows)

I have tried out Django with the development server that comes with it - and I never had any issues. I decided to try it out with xampp as I'll be hosting my web app on a VPS soon. The problem I'm having is that whenever I try to use the syncdb command after creating a table in the models.py file, I get an error:

ImportError - No module named "my table/class name here".

I use python 2.7 in my PATH variable, I have django-admin.py in my xampp root folder, and I have successfully created a project and my first app with django-admin.py. But I can't interact with the database at all.


Models.py:
from django.db import models

# Create your models here.

class messagechat(models.Model):
    username = models.CharField(max_length=150)
    body = models.CharField(max_length=800)
    score = models.DecimalField(max_digits=10)

settings.py:(database section only)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': dbnamehere',
        'USER': 'userhere',
        'PASSWORD': 'pswdhere',
        'HOST': 'using local host',
        'PORT': 'porthere', 
    }

Error Message I receive In command Prompt:




Do I have any chance of figuring out what is wrong here?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dad472c0-c154-4e27-a355-89fb7b02743d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment