Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example data errors #3

Open
jondbaker opened this issue Dec 2, 2012 · 10 comments
Open

Example data errors #3

jondbaker opened this issue Dec 2, 2012 · 10 comments

Comments

@jondbaker
Copy link
Contributor

When trying to view /docs/example/<resource_name>/ 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
Copy link
Owner

juanique commented Dec 3, 2012

Are you using django-south?

@jondbaker
Copy link
Contributor Author

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

@juanique
Copy link
Owner

juanique commented Dec 4, 2012

Could you post a full stacktrace?

@jondbaker
Copy link
Contributor Author

[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
Copy link
Owner

juanique commented Dec 5, 2012

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
Copy link
Contributor Author

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
Copy link
Owner

juanique commented Dec 5, 2012

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

@jondbaker
Copy link
Contributor Author

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

@juanique
Copy link
Owner

juanique commented Dec 5, 2012

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants