Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:02:39+00:00 2026-06-10T18:02:39+00:00

Working with Ubuntu 12.04 headless server Python v2.7.3 Django v1.3.1 FINAL Python came preloaded,

  • 0

Working with Ubuntu 12.04 headless server
Python v2.7.3
Django v1.3.1 FINAL

Python came preloaded, I installed django from apt-get python-django

I will note that I have setup and configured 2 servers for development use. Both for the practice and because I travel a lot and having a VM handy is always nice. However, this particular machine is giving me trouble and I cannot fathom the reason.

my previous setups where pretty straightforward. install ubuntu, install python-django, copy files to server, check permissions, run python manage.py syncdb, then run python.manage.py runserver 0.0.0.0:8080 and everything worked. For some reason this is not working on this server. I’m completely lost as I haven’t changed anything and I’m fairly certain I haven’t done anything different.

Any help is appreciated and I offer Thanks in advance

   $python manage.py shell
   ...
   >>>import pwht.models
   >>>k = Device(serial="something", mac="something", ip="10.211.119.50", active = True)
   Traceback (most recent call last):
   File "<console>", line 1, in <module>
   NameError: name 'Device' is not defined

My path is in the sys.path under manage.py

charles@Jobserver-Gibby:~/pwht/pwht$ python manage.py shell
Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sys
>>> print sys.path
['/home/charles/pwht/pwht', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/u
sr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>> 

for the sake of completeness

charles@Jobserver-Gibby:~/pwht/pwht$ python manage.py shell
Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from pwht.models import Device
>>>

import django also works without issue though I have not listed it here.

Here is the other side of the coin I had forgot to mention:

charles@Jobserver-Gibby:~/pwht/pwht$ python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): no
Installing custom SQL ...
Installing indexes ...
No fixtures found.
charles@Jobserver-Gibby:~/pwht/pwht$ 

None of my tables from models are created. This is true in Mysql as well.

Here are my files in the project

manage.py

   #!/usr/bin/env python
   from django.core.management import execute_manager
   import imp
   try:
       imp.find_module('settings') # Assumed to be in the same directory.
   except ImportError:
       import sys
       sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
       sys.exit(1)

   import settings

   if __name__ == "__main__":
       execute_manager(settings)

settings.py

   # Django settings for pwht project.

   DEBUG = True
   TEMPLATE_DEBUG = DEBUG

   ADMINS = (
       # ('Your Name', 'your_email@example.com'),
   )

   MANAGERS = ADMINS

   DATABASES = {
       'default': {
           'ENGINE': 'django.db.backends.sqlite3',
           'NAME': '/home/charles/pwht/pwht/mydb.sql',                      
           'USER': '',                      
           'PASSWORD': '',                  
           'HOST': '',                      
           'PORT': '',                      
       }
   }

   TIME_ZONE = 'America/New_York'

   LANGUAGE_CODE = 'en-us'

   SITE_ID = 1

   USE_I18N = True

   USE_L10N = True

   MEDIA_ROOT = '/home/charles/pwht/pwht/media/'

   MEDIA_URL = '/media/'

   STATIC_ROOT = '/home/charles/pwht/pwht/static/'

   STATIC_URL = '/static/'

   ADMIN_MEDIA_PREFIX = '/static/admin/'

   STATICFILES_DIRS = (
       '/home/charles/pwht/pwht/statics',
   )

   STATICFILES_FINDERS = (
       'django.contrib.staticfiles.finders.FileSystemFinder',
       'django.contrib.staticfiles.finders.AppDirectoriesFinder',
   )


   SECRET_KEY = [purposely removed]

   TEMPLATE_LOADERS = (
       'django.template.loaders.filesystem.Loader',
       'django.template.loaders.app_directories.Loader',
   )

   MIDDLEWARE_CLASSES = (
       'django.middleware.common.CommonMiddleware',
       'django.contrib.sessions.middleware.SessionMiddleware',
       'django.middleware.csrf.CsrfViewMiddleware',
       'django.contrib.auth.middleware.AuthenticationMiddleware',
       'django.contrib.messages.middleware.MessageMiddleware',
   )

   ROOT_URLCONF = 'pwht.urls'

   TEMPLATE_DIRS = (
       '/home/charles/pwht/pwht/templates/',
   )

   INSTALLED_APPS = (
       'django.contrib.auth',
       'django.contrib.contenttypes',
       'django.contrib.sessions',
       'django.contrib.sites',
       'django.contrib.messages',
       'django.contrib.staticfiles',
   )

   LOGGING = {
       'version': 1,
       'disable_existing_loggers': False,
       'handlers': {
           'mail_admins': {
               'level': 'ERROR',
               'class': 'django.utils.log.AdminEmailHandler'
           }
       },
       'loggers': {
           'django.request': {
               'handlers': ['mail_admins'],
               'level': 'ERROR',
               'propagate': True,
           },
       }
   }

models.py

'''
Created on Aug 18, 2012

@author: Charles B. Gibby
'''
from django.db import models

class Device (models.Model):
    serial = models.CharField(max_length=30)
    mac = models.CharField(max_length=17)
    ip = models.IPAddressField()
    active = models.BooleanField()

    def __unicode__(self):
        return self.serial

class Console (models.Model):
    device = models.ForeignKey(Device)
    serial = models.CharField(max_length=30)
    address = models.CharField(max_length=2)
    active = models.BooleanField()

    def __unicode__(self):
        return self.serial

    class Meta:
        ordering = ['device', 'address']

class Current_zones (models.Model):
    console = models.ForeignKey(Console)
    zone = models.IntegerField()
    temp = models.IntegerField(null=True)
    when_temp = models.DateTimeField(blank=True, auto_now=False)
    output = models.IntegerField(null=True)
    when_output = models.DateTimeField(blank=True, auto_now=False)
    man_sp = models.IntegerField(null=True)
    when_man_sp = models.DateTimeField(blank=True, auto_now=False)
    trim = models.IntegerField(null=True)
    when_trim = models.DateTimeField(blank=True, auto_now=False)
    clamp = models.IntegerField(null=True)
    when_clamp = models.DateTimeField(blank=True, auto_now=False)
    auto_sp = models.IntegerField(null=True)
    when_auto_sp = models.DateTimeField(blank=True, auto_now=False)
    sp_type = models.IntegerField(null=True)
    when_sp_type = models.DateTimeField(blank=True, auto_now=False)

    def __unicode__(self):
        return u'%s-%s' % (self.console, self.zone)

    class Meta:
        ordering = ['console', 'zone']

class Message (models.Model):
    console = models.ForeignKey(Console)
    req_type = models.BooleanField() # 0 for Read and 1 for Write
    parameter = models.CharField(max_length=1)
    target = models.CharField(max_length=2)
    data = models.CharField(max_length=4)
    when_message = models.DateTimeField(blank=True, auto_now=False)
    tx = models.BooleanField()
    when_tx = models.DateTimeField(blank=True, auto_now=False)
    status = models.BooleanField()
    when_status = models.DateTimeField(blank=True, auto_now=False)

    def __unicode__(self):
        return u'%s-%s' % (self.console, self.parameter)

    class Meta:
        ordering = ['console', 'when_message']

class Recorded_zones (models.Model):
    console = models.ForeignKey(Console)
    zone = models.IntegerField()
    temp = models.IntegerField(null=True)
    when_temp = models.DateTimeField(blank=True, auto_now=False)
    output = models.IntegerField(null=True)
    when_output = models.DateTimeField(blank=True, auto_now=False)
    man_sp = models.IntegerField(null=True)
    when_man_sp = models.DateTimeField(blank=True, auto_now=False)
    trim = models.IntegerField(null=True)
    when_trim = models.DateTimeField(blank=True, auto_now=False)
    clamp = models.IntegerField(null=True)
    when_clamp = models.DateTimeField(blank=True, auto_now=False)
    auto_sp = models.IntegerField(null=True)
    when_auto_sp = models.DateTimeField(blank=True, auto_now=False)
    sp_type = models.IntegerField(null=True)
    when_sp_type = models.DateTimeField(blank=True, auto_now=False)

    def __unicode__(self):
        return u'%s-%s' % (self.console, self.zone)

    class Meta:
        ordering = ['console', 'zone', 'when_temp']

class Profiler (models.Model):
    console = models.ForeignKey(Console)
    climb = models.IntegerField()
    soak = models.IntegerField()
    hold = models.IntegerField()
    down = models.IntegerField()
    end = models.IntegerField()
    duration = models.IntegerField()
    when_duration = models.DateTimeField(blank=True, auto_now=False)

    def __unicode__(self):
        return self.console

    class Meta:
        ordering = ['console']    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:02:41+00:00Added an answer on June 10, 2026 at 6:02 pm

    3rd line in your first snippet; instead of

    import pwht.models
    

    did you try:

    from pwht.models import Device
    

    UPDATE: the pwht app is NOT included within your settings.py INSTALLED_APPS. Therefore add pwht within your INSTALLED_APPS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have django+python+apache2+mod_python installed hosted and working on ubuntu server/ linode VPS. php5 is
I'm working on a Python Gtk3 app on Ubuntu, which primarily uses WebView from
Working with Ubuntu 10.10 ... When installing WebSVN via apt-get with the following command:
Iam working on Ubuntu.(Linux) I want to redirect from the page one.php to two.php,
I am working on Ubuntu and installed the Azure SDK for Linux and got
I am working in ubuntu server 10.04 I am creating a test.h file which
I'm trying to note down workstation/System screen lock of each employee working in ubuntu
I am working on Ubuntu. How can I get MAC address of my machine
I'm trying to create python bindings for source-highlight-qt using sip. I'm working on ubuntu
I'm trying to get a Hello World app working with groovy/log4j/ubuntu (working with Groovy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.