I'm following your setup from here https://github.com/dannymilsom/djangae-blog and I'm able to run static django pages on GAE without any issues. The problems start when I try to use "djangae.db.backends.appengine" as I want to have some basic data stored in DB. I basically don't know how to get my django models synced to the datastore in GAE. When I follow this doc here http://djangae.readthedocs.org/en/latest/sandbox/, I end up using "./manage.py --sandbox=remote makemigrations" but that gives me nasty error like this:
https://gist.github.com/sikor80/334241b17b44b94b95c5
and additionally when I try to sync my models locally and get this error https://gist.github.com/sikor80/879b5df7fd8ff6d42f88, my models are very simple as shown https://gist.github.com/sikor80/1c294b3339a2ff91c343
Would anybody know how to deal with it?
thanks!
Just a guess, the errors show an appid name of 'XXX'. You need to create that project through the Google cloud console first before you can use it as an app-id
Related
i followed this solution to run customer django command programmatically , but it is limited for just one database connection.
I have django app configured with multiple database , is it possible to run custom django command using specific database connection?
exactly like when we use connections["DB_NAME_CONNECTION"].cursor() to execute an sql query
thanks a lot for your help!
One option is to create a new settings module (here's a guide) that contains your specific database connection configuration, and then use that settings module when using call_command():
management.call_command('mycommand', '--settings=mysite.settings.specificconnection')
I am trying my hand at Python. I have a created a simple app with MySQL as a back end and I want to use the application's table in another app.
Both of the applications are for the same project. Please help
Make sure all your app in registered in settings.py.Then import the model to other by appname.models.Modelname.
Execute Query:
ModelName.objects.all()
I'm having trouble getting my Django project to work with a CouchDB database.
I'm running Python 2.6.6, Django 1.3, and Lion on a Mac
I've got Django, CouchDB, and CouchDBKit installed. I can import all of them from the python interpreter without a problem. If I go to my CouchDB database URL, I can see the db.
The problem is, when I try to go to my django project URL, I get the following error:
You haven't set the database ENGINE setting yet.
I have the following lines in my settings.py file:
COUCHDB_DATABASES = (
('my_project.my_db', 'http://127.0.0.1:5984/my_db'),
)
The only possible solution I've found so far, is to set a throwaway database in the normal database engine settings. But, this just throws another error, because Django starts looking for database tables in the throw away DB.
Edit with new info:
I'm accessing my DB via an SSH tunnel
I'm able to create and access a CouchDB from the python interpeter.
I've run a test from the python interpreter, to access the app DB (again, via the tunnel), and the returned data accurately.
It's just when I try to access the actual site from a browser URL, I get the engine not defined error.
Django seems to be trying to use a normal DB (which isn't setup), instead of the CouchDB.
Any ideas?
Trying to get an oauth module to work I made the pro-move of : manage.py reset sites
This had the effect killing the admin and login functionality of my site.
So, my question is how to I get back to square one and fix what I broke.
Here is my current error when trying to display the admin tool:
DoesNotExist at /admin/
Site matching query does not exist.
Request Method: GET
Request URL: http://mdev.5buckchuck.com/admin/
Django Version: 1.3
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.`
I looked at the documentation but I am lost and tired in it:
http://docs.djangoproject.com/en/1.3/ref/contrib/sites/
It seemed to indicate: manage.py syncdb
So, I wonder what to do next...
You don't really need the sites framework if you only run one site from the project, so the easiest fix would be to remove the following item from your INSTALLED_APPS and the error should go away:
'django.contrib.sites'
You can also re-create the missing Site object from shell. Run python manage.py shell and then:
from django.contrib.sites.models import Site
Site.objects.create(pk=1, domain='mdev.5buckchuck.com', name='5buckchuck.com')
Provide SITE_ID=1 in settings.py. This will work.
I went through this problem too, while playing with django-allauth. The application offers the ability to delete sites. If you delete the one designated by the SITE_ID parameter in settings.py, you'll have to point the correct PK of another valid site.
If you deleted the default site example.com(changes are you did some cleanup after adding another site), you may simply want to select the other site you created by setting SITE_ID to 2 for example. If you work with SQL database, look for the django_site table, and locate the site ID you wish to work with.
This way, no need to go into shell and recreating a not necessary desired site.
If you need sites, you can use data fixtures. Read the docs for tip about enabling the sites framework.
I'm using Django along with appengine. When I try to save a record, I'm getting the error
"app_id must not be empty". The application name has been set in app.yaml. I also added
os.environ['APPLICATION_ID'] = 'test' in main.py. However, I continue to get the same error.
When I try to save a record, I'm getting the error "app_id must not be empty".
When I'm using appengine as "standalone" e.g. (unit testing) in order to fix the "app_id must not be empty" error I always execute:
app_id = 'XXXXXX'
os.environ['APPLICATION_ID'] = app_id
datastore_path = os.path.join(tempfile.gettempdir(),'dev_appserver.datastore')
history_path = os.path.join(tempfile.gettempdir(),'dev_appserver.datastore.history')
require_indexes = False
apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
datastore = datastore_file_stub.DatastoreFileStub(app_id, datastore_path, history_path, require_indexes=require_indexes)
apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore)
just before my code that use the Google App Engine datastore.
If you run the appserver locally you shouldn't need this code because all the magic is made by the framework reading the app.yaml file
I haven't seen your error before. Note that you can't use the native Django database functions without using the "Django Helper" application:
http://code.google.com/appengine/articles/appengine_helper_for_django.html
You do not need to use Django Helper if you are only using parts of Django (but using native App Engine Models for storage):
http://code.google.com/appengine/docs/python/datastore/overview.html