juanique / django-tastydocs

Automatic Web Documentation for django-tastytools
Other
12 stars 18 forks source link

Example data errors #3

Open jondbaker opened 11 years ago

jondbaker commented 11 years ago

When trying to view /docs/example// I receive a DatabaseError:

no such table: tastypie_apikey

... in the browser.

I am generating api_key objects in a receiver function for the 'post_save.connect' signal on the 'auth_models.User' model. If I disable the receiver connection, I receive:

Error: Unknown command: 'migrate'

followed by a 500 error notification in the terminal.

juanique commented 11 years ago

Are you using django-south?

jondbaker commented 11 years ago

django-south is installed in my virtualenv, but I've yet to install it within my django application (but will soon).

juanique commented 11 years ago

Could you post a full stacktrace?

jondbaker commented 11 years ago

[04/Dec/2012 19:04:40] "GET /api/v1/support-ticket/schema/ HTTP/1.1" 200 2182 Error: Unknown command: 'migrate' Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "/home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in call return self.application(environ, start_response) File "/home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 241, in call response = self.get_response(request) File "/home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, _callback_args, _callback_kwargs) File "/home/jondbaker/python/virtualenvs/stratos_env/src/django-tastydocs/tastydocs/views.py", line 56, in example_data with test_db(verbosity=0): File "/home/jondbaker/python/virtualenvs/stratos_env/src/django-tastydocs/tastydocs/views.py", line 29, in enter connection.creation.create_test_db(self.verbosity) File "/home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/south/hacks/django_1_0.py", line 100, in wrapper f(_args, _kwargs) File "/home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/django/db/backends/creation.py", line 271, in create_test_db load_initial_data=False) File "/home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/django/core/management/init.py", line 150, in call_command return klass.execute(_args, *_defaults) File "/home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 249, in execute sys.exit(1) SystemExit: 1 [04/Dec/2012 19:04:40] "GET /docs/example/support-ticket/ HTTP/1.1" 500 59

juanique commented 11 years ago

mmmh /home/jondbaker/python/virtualenvs/stratos_env/local/lib/python2.7/site-packages/south/hacks/django_1_0.py... that doesn't look right.

Maybe there's an issue when south is installed on the python env but not as a django auth?

jondbaker commented 11 years ago

Jackpot. Strange error since south isn't even installed... Your suggestion took care of the 'migrations' error, but then I received:

Exception at /docs/example/support-ticket/ Could not mockup data for SupportTicket.uuid <class 'django_extensions.db.fields.UUIDField'>

I verified that if I delete the referenced uuid field on the SupportTicket model then everything works like a charm.

juanique commented 11 years ago

That happens when django-chocolate cannot create a value for SupportTicket.uuid. What type of field is it?

jondbaker commented 11 years ago

UUIDField from the django-extensions app: https://github.com/django-extensions/django-extensions

juanique commented 11 years ago

Yeah, the solution for that is provide your own mock generator for that value. That feature is well supported on django-chocolate (the lib used by django-tastydocs to generate the examples) but I'm not sure if it's well integrated with tastytocs. I'll try to take a look at that during the week. You can always try to poke around it by yourself.

jondbaker commented 11 years ago

Yeah I'll definitely take a look myself. Thanks for the timely responses and the work you've put in on this.