Btw. at the moment I ended up with

ON_APP_ENGINE = os.getenv('SERVER_SOFTWARE', '').startswith('Google App 
Engine')
if ON_APP_ENGINE:
   DATABASES = {
       'default': {
           'ENGINE': 'django.db.backends.mysql',
           'HOST': '/cloudsql/supple-century-124208:supple-century-124208',
           'NAME': 'appengine_django_skkeleton',
           'USER': 'root',
       }
   }
else:
   DATABASES = {
       'default': {
           'ENGINE': 'django.db.backends.mysql',
           'NAME': 'appengine_django_skkeleton',
           'USER': 'root',
           'PASSWORD': '1234',
           'HOST': '127.0.0.1',
           'PORT': '3306',
       },
       'prod': {
           'ENGINE': 'django.db.backends.mysql',
           'NAME': '<prod-database-name>',
           'USER': '<prod-database-user>',
           'PASSWORD': '<prod-database-password>',
           'HOST': '<prod-database-ip>',
           'PORT': '3306',
       }
   }


and than running management task through the remote api shell

remote_api_shell.py -s APP-ID.appspot.com

import os
from google.appengine.ext import vendor
vendor.add('lib')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
import django
django.setup()
from django.core import management
management.call_command('makemigrations', 'polls', interactive=True)
management.call_command('migrate', interactive=False)

management.call_command('migrate', database='prod', interactive=False)
management.call_command('createsuperuser', database='prod', 
interactive=True)


./manage.py was getting unusable after I started using things from `from 
google.appengine.api`. Is there an easier way to use management commands 
with the GAE stuff loaded then djangae is doing it? 
https://github.com/potatolondon/djangae/blob/master/djangae/sandbox.py


On Monday, March 7, 2016 at 3:11:54 PM UTC+1, Silvan Spross wrote:
>
> I'm used to deploy to managed servers through some Fabric scripts (or CI's 
> using them). I also run a project with Docker, where Django, Celery, Redis, 
> RabbitMQ, Postgres and Ngnix are in separate containers.
>
> However, now I want to give Google App Engine a try. I don't want to use 
> Google Container Engine or Google App Engine Managed VM for now. I consider 
> them as another option if using plain Google App Engine does not work out.
>
> My goals are:
>
>    1. 
> *Separated Environments *Development, Stage and Production (where stage 
>    and production can be just different app engine projects and so can be 
>    considered as "the same").
>    
>    2. *Using Task Queue* (instead of Celery)
>    Used for async tasks and scheduled ones (cronjob).
>    
>    3. *Using Memcache* (instead of Redis)
>    For caching keys up to caching templates etc.
>    
>    4. 
> *Using Cloud Storage (Buckets) as Storage backend *For media files.
>    
>    5. *Using CloudSQL* (instead of Postgres)
>    I don't care about nonrel for the moment. Using Datastore should be a 
>    future goal here.
>
> My subject is all about how to setup and separate environments (1). But if 
> someone has feedback or input about another goal, why e.g. not to use it, 
> I'm very happy to hear! Btw. my test project is much alike 
> https://github.com/GoogleCloudPlatform/appengine-django-skeleton for now.
>
> What bugs me at the moment:
>
>    - Load different settings e.g. database based on 
>    os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine')
>    Is this best practice?
>    
>    - I run my application local with:
>    source env/bin/activate
>    dev_appserver.py app.yaml
>    to have python libraries that use C extensions loaded locally (like 
>    mysql) and that
>    google.appengine
>    is available. But how can I run django management commands locally? 
>    Whats best practice here?
>    
>    - And the biggest one: Whats best practice to migrate production 
>    database? I heard stuff about interacting with the database through a 
>    separate GCE instance running scripts. Or is there no best practice 
> because 
>    with Datastore "you don't need" migrations ;)
>
> I would be very happy about some tipps pointing me to the right direction. 
> Thank you!
> Silvan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/55c6f2c1-abbd-428b-8430-582ddb30b779%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to