Using Beaker on Google App Engine (Django) - django

How do we use Beaker to implement sessions on Google App Engine? (I say Beaker because gmemsess is short-lived, and therefore not suitable). There seem to be no examples online.
We're using Django 1.1 via App Engine Helper (not app-engine-patch).

You need to specify the session type as 'ext:google', like this. You also need to edit beaker/cache.py, deleting the section that uses pkg_resources to search for plugins, as this isn't supported on App Engine.

Related

What will be "session_memcached_host:" when I use Memcache service provided by Google Cloud Application Flex. Engine?

I am evaluating Symfony 5.0.1 with Google Cloud Application Flexible Engine.
I couldn't use Memcache service provided in App Engine because I don't know which "memcached_host" should be used.
Memcache in Application Engine
I tried using "session_memcached_host:localhost" in services.yaml but it doesn't work
Same Project of Symfony is tested locally and it works well with local Memcache server (in my local setup).
Here is an example of a PHP app using memcache on Google App Engine Standard.
Here specifically you can see how you should configure memcache to work on App Engine
I have tried the example above myself and it's working as expected.
NOTE: You have mentioned App Engine Flex but provided examples and docs on
Standard.
Memcache is currently generally available for App Engine Standard.
Please keep in mind that there are huge differences between App Engine Flex and Standard.
I am not App Engine expert but looking at the example below it appears you can directly call it from your code. Everything is preconfigured and you can just call it directly from your code. See the link below for further information:
https://medium.com/google-cloud/appengine-memcache-service-google-cloud-platform-8214ee9eada1

Deploy Django project on Google App Engine

I have developed one example project in django1.4 & python 2.7, I want to deploy it on google app engine,
but how to configure my project as per App Engine we didn't get.
We have a site running on google app engine, but it is including with all html,js.
How do we configure a database on google app engine to deploy our django project?
Possibly the best option is to use Django Non-Rel. It's the only way (that I know of) to use the Django ORM (the django database interface) on Google App Engine without using Google's costly cloud SQL service. To do this, you'll need to use a customized version of Django and import several more libraries. It's a small project to get it up and running, but it's worth the effort. More information can be found on this website:
http://django-nonrel.org/
Note, that even though django-nonrel allows you to use the Django database interface, it will not allow you to use certain SQL features, such as joins. If you need joins, then your best option would be to use Google App Engine + Google Cloud SQL. Documentation for that is here.
Regarding the comments:
Yes, it can run on windows, I run it on Windows.
Also, the site allbuttonspressed.com is old and out of date, use the
one above for information.

Setting up Django on Google App Engine for DataStore

How do I setup Django on Google App Engine to use DataStore? I did a bunch of searches and some seemed to point to something called django-nonrel. But I couldn't find anything that looked like a definitive guide up-to-date (dated around 2012-2013).
The djangae project seems to be what you're looking for. From their documentation:
Djangae (jan-gee) is a Django app that allows you to run Django
applications on Google App Engine, including (if you want to) using
Django's models with the App Engine Datastore as the underlying
database.
It has a Database backend that supports AppEngine's Datastore, so you can use Django's ORM. In addition to Django's default fields, a number of other field types are added in the project.
You should consider the list of limitations carefully though.

Is it still possible to use django-mediagenerator on Google App Engine

I've been working on a existing project at a new company and one of the problems we're running into is Javascript code duplication. We're working in Google App Engine, and I have heard of the Django media generator asset manager which seems like it could solve some of our problems. However, after reading through the docs on that page and pages like this one on running Django in Google App Engine, I'm not sure if it is even possible to run django-mediagenerator on Google App engine.
Is it still possible to use django-mediagenerator on Google App Engine? Has the project gone stale? Is there some other media generator that I should be using in app engine?
Any help would be appreciated. Thanks :)
Django-mediagenerator is developed with app-engine in mind, as you can see in this blog post.
So : yes you can go with it ;-)
As an alternative I've had some success using webassets as an asset manager in Google App Engine, although because of the limitations of the production environment its a command line process before deployment.
There's a basic app engine example in the repository, so it's fairly quick to setup.

How to migrate Django project to Google App Engine

I am looking for a guide to migrate Django project to Google App Engine and use Google's datastore. The most of the guides I found were linked to Django-Appengine using Django-nonrel (but I want to use GAE's native support).
Going through GAE getting started guide, it says:
Google App Engine supports any framework written in pure Python that speaks CGI (and any WSGI-compliant framework using a CGI adaptor), including Django, CherryPy, Pylons, web.py, and web2py. You can bundle a framework of your choosing with your application code by copying its code into your application directory.
I understand that I won't be able to use some features of Django in that case (majorly the admin feature) and would also need to restructure the models.
From other reading, I also found that latest SDK of GAE now includes Django 1.3 on Python 2.5.
I tried to put all files from my Django application to a GAE project, but couldn't get it all to work together.
Please provide some basic guide using which I may migrate my Django project to Google App Engine's code.
Thanks.
For an existing Django app, using django-nonrel is the simplest approach; it is very popular so you should be able to find help with specific errors you get quickly.
Another approach is written up in this article: http://code.google.com/appengine/articles/pure_django.html -- it goes the other way, taking an App Engine app that uses Django for dispatch, templates, and forms, but not for models, and describes how to make it run in a native Django environment. Maybe you can glean some useful hints for your situation from it.
I've used django-nonrel, which behaves pretty much like django, except that operations with JOINs will return errors. I've basically worked around this by avoiding ManyToMany fields, and essentially building that functionality manually with an intermediate table.
So far I've ran into two problems with Django-nonrel:
1. No access to ancestor queries, which can be run in a transaction. There's a pending pull request for this feature though.
2. You can't specify fields that are not indexed. This could significantly increase your write costs. I have an idea to fix this, but I haven't done so yet.
(Edit: You CAN specify fields that are not indexed, and I've verified this works well).
2 (new). Google is pushing a new database backend called ndb that does automatic caching and batching, which will not be available with django-nonrel.
If you decide not to use django-nonrel, the main differences are that Django models do not run under App Engine. You'll have to rewrite your models to inherit from App Engine's db.Model. Your forms that use Django's ModelForm will need to inherit from google.appengine.ext.db.djangoforms instead. Once you're on App Engine, you'd have to port back Django if you ever take your app somewher else.
If you already have a Django application you might want to check this out. You won't work with App Engine's datastore but Google Cloud SQL might fit your needs.