production
'UNICODE_JSON': False
in settings under REST_FRAMEWORK
configuration variable in odert to show utf-8 characters form the constants file in games apphttp-server web/react -p 8000
./web/django/truegamer/manage.py runserver 8080
in order to run it with localhost:8080
gulp w-react
w-react-django
react-prod
lunchy start postgres
lunchy stop postgres
manage.py runserver 0.0.0.0:8000
psql
\l
\du
\connect <name of db>;
SELECT * FROM <table>;
Based on this tutorial
sudo gem install lunchy
lunchy start postgres
(to stop it use lunchy stop postgres
psql
in shellCREATE DATABASE <myproject>;
CREATE USER <username> WITH PASSWORD 'password';
ALTER ROLE myprojectuser SET client_encoding TO 'utf8';
ALTER ROLE myprojectuser SET default_transaction_isolation TO 'read committed';
ALTER ROLE myprojectuser SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE <myporject> TO <user>;
you can use this in the postgres shell (although with gae could have some preoblems, better use the django shell): UPDATE auth_user SET is_superuser=true, is_staff=ture WHERE username='MikeWoodcock';
or in django, which is not the best option:
manage.py shell
from django.contrib.auth.models import User
user = User.objects.get(username=
username`)user.is_staff = True
user.is_superuser = True
user.save()
psql: FATAL: database <user> does not exist
: the solution is to run createdb
in the normal shellinside of the django project (at the same level of manage.py
) use the following command to deploy gcloud app deploy
In order to be able to connect to the google cloud sql instance (postgres) follow the next steps:
curl -o cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.darwin.amd64
chmod +x cloud_sql_proxy
use the following command in the same directory where you downloaded cloud_slq_proxy
./cloud_sql_proxy -instances="[YOUR_INSTANCE_CONNECTION_NAME]"=tcp:5432
you can use migrate
or makemigrations
to create the tables needed.first make sure you are logged in into the correct account with gcloud config configurations activate <name>
, to know which configs are use gcloud config configurations list
static
folder of each app./manage.py collectstatic
gsutil rsync -R static/ gs://<your-gcs-bucket>/static
it sometimes will be necesary to change the rsync
option because sometimes it will delete the cors filegsutil defacl set public-read gs://<your-gcs-bucket>
gsutil cors set cors-json.file.json gs://tg-static
or look hereFollow the next link: here
gulp react-prod-django
gulp css-prod
See here