Techy
Techy

Reputation: 2654

Localhost for django not loading after creating table in sqlite

I am new to python and Django.I have installed Django 1.5.1 and python 2.7.My OS is windows 7.I am doing coding in eclipse.I have typed python manage.py runserver in windows powershell and started the server.then I changed the server port number to 8080 by the command python manage.py runserver 8080.Both conditions worked initially.I am trying to use sqlite database.I have typed python manage.py syncdb for creating tables.It asks for a superuser and somehow i didn't type any password and operation got failed.I have seen in django documentation that use .schema for viewing the tables created.My issues are:

  1. I am unable to view the tables created .I think I am wrong in the usage of .schema command
  2. When I reload the http://127.0.0.1:8080/page,it didnt get connected even after restarting the wamp server. My settings.py is like this

    ADMINS = (
    # ('Your Name', '[email protected]'),
    )
    MANAGERS = ADMINS
    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
    'NAME': 'C:\\Eclipse\\workspace\\mysite\\src\\sqlite.db',                      # Or path to database file if using sqlite3.
    # The following settings are not used with sqlite3:
    'USER': '',
    'PASSWORD': '',
    'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
    'PORT': '',                      # Set to empty string for default.
      }
    }
    
    # Hosts/domain names that are valid for this site; required if DEBUG is False
    # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
    ALLOWED_HOSTS = []
    
    # Local time zone for this installation. Choices can be found here:
    # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
    # although not all choices may be available on all operating systems.
    # In a Windows environment this must be set to your system time zone.
     TIME_ZONE = 'Asia/Kolkata'
    
     INSTALLED_APPS = (
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.sites',
      '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',
       )
    

Please help me.Thanks for your answers
The image of powershell

Upvotes: 0

Views: 656

Answers (2)

toni
toni

Reputation: 723

If you use a WAMP server, why don't you use mysql instate of sqlite?

Upvotes: 0

Gandirham
Gandirham

Reputation: 916

It looks like Django can't set-up the DB.

Try to replace:

'NAME': 'C:\\Eclipse\\workspace\\mysite\\src\\sqlite.db', 

By:

'NAME': 'sqlite.db', 

In your settings.py.

It could be a path problem.

You should also check the directory permissions to be sure that Django can write the DB to it. I have no experience with Windows regarding this point.

Upvotes: 1

Related Questions