and that is probably what's not working on your setup.
Try this:
$ ./manage.py shell
>>> import django
>>> django.get_version()
>>> from django.contrib import admin
>>> admin.site
..and see how far you can go before the first exception. Feel free to
paste the results in a reply.
Sincerely,
André Terra
On 6/29/11, Kyle Latham <kly.latham@gmail.com> wrote:
> I searched this group for that error, and browsed through several
> pages and dozens of posts...but none of them helped me solve my error.
>
> Yesterday I had my server up and running, and I left it running
> overnight. I do not remember changing anything in any of my .py files,
> but when I shut down my server to restart it, I was getting an error:
>
> "Import Error: No module named site"
>
> I have no idea what is going wrong, but here is all my code thus far
> (I'm following the tutorial to create my own app that will display
> various material measurements)
>
> -----------------------------------------------
> models.py
> -----------------------------------------------
> from django.db import models
>
> # Create your models here.
> class adhesive(models.Model):
> measurement_id = models.CharField(max_length = 200)
> material_id = models.CharField(max_length = 200)
> program_name = models.CharField(max_length = 200)
> date = models.DateField()
> measurement_method = models.CharField(max_length = 30)
> frequency_low = models.IntegerField()
> frequency_high = models.IntegerField()
>
> class ceramic(models.Model):
> measurement_id = models.CharField(max_length = 200)
> material_id = models.CharField(max_length = 200)
> program_name = models.CharField(max_length = 200)
> date = models.DateField()
> measurement_method = models.CharField(max_length = 30)
> frequency_low = models.IntegerField()
> frequency_high = models.IntegerField()
>
> class composite(models.Model):
> measurement_id = models.CharField(max_length = 200)
> material_id = models.CharField(max_length = 200)
> program_name = models.CharField(max_length = 200)
> date = models.DateField()
> measurement_method = models.CharField(max_length = 30)
> frequency_low = models.IntegerField()
> frequency_high = models.IntegerField()
>
>
> ---------------------------------------------------
> settings.py
> ---------------------------------------------------
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.mysql', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'materials', # Or path to
> database file if using sqlite3.
> 'USER': 'root', # Not used with sqlite3.
> 'PASSWORD': 'xxxxx', # Not used with sqlite3.
> 'HOST': '', # Set to empty string for
> localhost. Not used with sqlite3.
> 'PORT': '', # Set to empty string for
> default. Not used with sqlite3.
> }
> }
>
> ...
>
> ROOT_URLCONF = 'material_measurements/urls'
>
> TEMPLATE_DIRS = (
> # Put strings here, like "/home/html/django_templates" or "C:/www/
> django/templates".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> "C:/Django/material_measurements.materials"
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'material_measurements.materials',
> # 'django.contrib.messages',
> # 'django.contrib.staticfiles',
> # Uncomment the next line to enable the admin:
> 'django.contrib.admin',
> # Uncomment the next line to enable admin documentation:
> # 'django.contrib.admindocs',
> )
>
>
>
>
> ---------------------------------------
> urls.py
> ---------------------------------------
> from django.conf.urls.defaults import *
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'material_measurements.views.home', name='home'),
> # url(r'^material_measurements/',
> include('material_measurements.foo.urls')),
>
> # Uncomment the admin/doc line below to enable admin
> documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> # Uncomment the next line to enable the admin:
> (r'^admin/(.*)', admin.site.root),
> )
>
>
>
>
>
> Thanks for the help!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
Sent from my mobile device
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment