Google App Engine skip_files to skip entire folder - google-app-engine

I'm editing the app.yaml file so that all files within a particular folder are not uploaded to GAE.
Following the instructions found here, I've tried the following:
skip_files:
- /tester/^(.*/)?\.^(.*/)?$
skip_files:
- /tester/.*
skip_files:
- /tester/^(.*/)?#.*#$
None of the above seems to work, as new files added to the folder tester keep being pushed to GAE.

If your directory is nested inside the project:
skip_files:
- ^(.*/)?.*/some_dir/.*

Seems that this works:
skip_files:
- ^tester/*.*
Based on the results I got, it seems that:
the initial / should not be included.
the caret (^) is needed to tell the system where the string to interpreted begins;
to include any file, the notation *.* seems to work.
Any comment is welcome!

Related

Are github.com repository urls pointing to a folder or a file?

is this URL pointing to a .git file, or is it a folder path? In other words, is /redditclone.git a folder path or a file? The .git portion is throwing me off.
https://github.com/salvatoreallegra/redditclone.git
Thanks.
The .git is optional and still reference to a folder on GitHub side (it will be just redditclone if cloned on your side)
On GitHub side, those repositories are bare repos (meaning without working tree, just the Git data content), and by convention, a bare repo is designated by a .git extension (even thoug it is a folder)
This is a folder, the same way as explained on setting up the server:
https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
$ cd /srv/git
$ mkdir project.git
this is standard made since the "long ago" times when there were many version control systems used at the same time by the companies and this suffix was meant to distinguish one from another. GitHub decided to adopt that.

YAML errors in semantics

I have several (independent) questions if you can inform me. about Google Cloud App Engine
1) I would like to know if it was way, once again, with the command, that the application is deployed, can I remove from the "far"?
Do I delete a file locally; and that I do the command with the application gcloud to deploy, the file meets up to date or is automatically removed from the remote?
If "no", how could I remove from "remote"?
2) What you have already sent to the server, can I recover? Do kind do the reverse command to deploy the application?
3) I did not quite understand the difference between the static_files and upload exactly all that in the managers: of the file YAML. I saw in the documentation but after reading I did not understand everything. static_files, the directory followed by \ 1 and in the download, the full path with regular expression, is that it?
Yes but suddenly, if I want to include all subfolders with static_files, can I?
Kind that
static_files: / res / js / \ 1
includes
/res/js/toto/sousdossier/fichier.html

Project Directory Does Not Contain app.yaml

I'm following the instructions here https://console.developers.google.com/start/appengine
I've downloaded and unzipped the project file from that page - it's the python and flask one. When I get to the instruction dev_appserver.py appending-try-python-flask it gives the error.
google.appengine.tools.devappserver2.errors.AppConfigNotFoundError: "." is a directory but does not contain app.yaml or app.yml
It most certainly does contain an app.yaml file. It looks like this.
application: hello-flask-app-engine
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: .*
script: main.app
libraries:
- name: jinja2
version: "2.6"
- name: markupsafe
version: "0.15"
Unlike this post Uploading a static project to google app engines mine doesn't have any skip files lines to delete.
There is a README.md that mostly follows the Google Dev web page, except that instead of downloading the project from that page it instructs to git clone https://github.com/GoogleCloudPlatform/appengine-python-flask-skeleton.git and that doesn't exactly match the zip file I downloaded.
The requirement.txt file says Run 'pip install -r requirements.txt -t lib/' but Windows 7 says pip is not a recognized command.
Is my app.yaml not correct? Why would it say it doesn't exist?
Simply closing the command prompt window and reopening it made it work. I don't know how or why.
You may be mis-typing appengine-try-python-flask (the real name) as appending-try-python-flask (which is what you show in your question).
If that's not the case, can you please show the effects of dir appengine-try-python-flask and dir appending-try-python-flask from the directory (AKA folder) you're now trying to run dev_appserver.py from?
probably you use py-charm, you need to add to configuration in line 'Working directory' the path of project like: C:\Users\user\Desktop\projects\water
It's repose to work

Google App Engine, can people download my source code?? (with PHP)

I'm new to GAE, and have big doutbts on how it works. Mainly the app.yaml configuration file. If i have this structure for example:
/
/index.php
/scripts/script.php
On app.yaml I should write something like this for example (the basic to work), right?
application: myapp
version: 1
runtime: php
api_version: 1
handlers:
- url: /
script: index.php
- url: /scripts/script.php
script: scripts/script.php
Is this correct? And if i have a lot of scripts on the scripts directory, should i put an entry for all of them?
I ask this (I think its a really stupid question but i want to be sure) because i have realised that if i put the scripts directory as a static_dir, like:
- url: /scripts
static_dir: scripts
... if i go to the URL of that file (http://mydomain.com/scripts.script.php) i can download the source code.
So I guess that static_dir is not for accessing a whole directory's content, and as it's name says... is just for static content like photos for example, right? so for each script i should write a line on the app.yaml to be accesible?
Sorry about my stupid question, my english is not so good and i'm new at this so i have this doutbt ;)
Thanks a lot in advance!
You can find some detailed examples here of PHP and app.yaml here:
https://developers.google.com/appengine/docs/php/config/appconfig
If you have a large number of *.php files that you want to make executable, you can use wildcards. For example:
- url: /(.+\.php)$
script: \1
Will map anything URL ending in .php to the equivalent filepath. So
http://myapp.appspot.com/some/directory/file.php
will map to
some/directory/file.php
in your app's directory.
Don't put anything in static directories that you don't want the world to see. static directories are intended as a fast shortcut for serving things like images, CSS, and JavaScript.
.php files (or .py files if you're using Python) need to be 'executed' (evaluated) on the server (App Engine) side. Putting them in a static_dir puts them out of reach of the execution environment, which isn't what you want.

Migrating GAE app from python 2.5 to 2.7

I am trying to migrate my app and everything worked fine until I changed in app.yaml
from threadsafe: false to threadsafe: true.
The error I was receiving was:
threadsafe cannot be enabled with CGI handler: a/b/xyz.app
After some googling I found:
Only scripts in the top-level directory work as handlers, so if you have any in subdirectories, they'll need to be moved, and the script reference changed accordingly:
- url: /whatever
# This doesn't work ...
# script: lib/some_library/handler.app
# ... this does work
script: handler.app
Is there any workaround for this(if above research is valid), as I don't want to change my project hirarchy?
You can have your handlers anywhere as long as it's a valid python import path.
My app.yaml is full of entries like
- url: /_ah/queue/deferred
script: google.appengine.ext.deferred.application
login: admin
The folders need __init__.py in them to make them work as modules, but you can usually replace any / with .
Alternatively do as Daniel suggest, and note that you'll probably have to mangle the sys.path first to include lib dir and then import handler.
Put a main file in the top-level directory and import all your handlers there, then reference them via that file

Resources