0

I've installed following packages https://github.com/zacharyvoase/django-postgres via pip and virtualenv.:

pip install git+https://github.com/zacharyvoase/django-postgres.git

It was installed succesfully. I used it in my model(As described in its documentaion)

from django.db import models
import django_postgres as pg

USStates = pg.Enum('states_of_the_usa', ['AL', 'WY'])

class Address(pg.CompositeType):
    line1 = models.CharField(max_length=100)
    line2 = models.CharField(max_length=100, blank=True)
    city = models.CharField(max_length=100)
    zip_code = models.CharField(max_length=10)
    state = USStates()
    country = models.CharField(max_length=100)

when I try to sync it via shell, it throws an error:

(virtualenv) user$ python manage.py sync_pgviews 

Unknown command: 'sync_pgviews'
Type 'manage.py help' for usage.

Have I left something after installing an app? And is it the correct way to install django new app?

1
  • short answer is - no. Commented May 29, 2013 at 8:07

2 Answers 2

1

In order for management commands to work, the app has to be added to INSTALLED_APPS. However, a basic problem that you have is that the module doesn't support ENUM yet. Its still a work in progress.

0

After adding new app:

  1. add app to INSTALLED_APPS in settings.py
  2. run python manage.py syncdb
  3. add urls to urls.py

Perhaps you should go through this (again?) https://docs.djangoproject.com/en/dev/intro/tutorial01/

1
  • I've read that, line by line, i can use django's models and syncing it . At first I just forgot to add it in settings.py. But now when i try to sync it throws AttributeError: 'module' object has no attribute 'Enum'
    – eneepo
    Commented May 29, 2013 at 8:30

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.