google app engine - permission denied error - python

The problem
my appication won't update on the dev server or the live server unless I do step 3 (below), every single time. Otherwise, I will get permission problems as shown below
e2016-01-08 12:47:58,781 ERROR appcfg.py:2438 An error occurred processing file '': HTTP Error 403: Forbidden Unexpected HTTP status 403. Aborting.
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u's~project-name').
--- end server output ---
I'd ideally like to test just using dev_appserver.py
Things I've already tried
appcfg.py update --no_cookies . after the webpage opened for me to sign in, I got
No data received
ERR_EMPTY_RESPONSE
and my terminal was stuck on " --noauth_local_webserver "
appcfg.py rollback . That leaves me with the same error:
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u's~').
--- end server output ---
appcfg.py -A <project name> update . This just returns error from step above
appcfg.py --no_cookies --oauth2 --email=myemail --noauth_local_webserver update . this uploads the project to my server, but, I'm tired of having to 'allow' then paste the code back into the terminal every single time
shutting down app engine launcher, removing project from launcher then adding back
restarting computer, turing off computer
launching from the terminal, launching from app engine launcher
Note: I'm already signed into google chrome
What should I try next?

Every time you use the '--no_cookies' option, you are telling appcfg to never save your credentials, so it's always going to prompt you every time you upload your app.
Running appcfg.py update app.yaml or appcfg.py update <dir_name> just once should be sufficient, since the '--oauth2' option is now the default and currently the only support authentication method.
On a side note, appcfg stores certain files under your user directory (C:\Users\<username> on Windows, or /home/<username> on Linux / Mac) named '.appcfg_*' for its cookies and saved auth tokens. You may need to show hidden files / extensions to see them. Sometimes deleting these files and re-running appcfg can help with auth not working.

Related

When running Python Flask Server, Jenkins is not successful and continues to load

I am building CICD through Jenkins.
But there are problems.
It is planning to upload source code first and turn on flask server through batch file.
I wrote a shell script for Jenkins' Build>Execute Shell.
postCommand=/cygdrive/c/workspace/ContactPortal_Flask/run.bat
sshpass -p ${deployPassword} ssh -o StrictHostKeyChecking=no ${deployUser}#${deployServer} ${postCommand}
Here is run.bat file
set FLASK_ENV=development
set path=%path%;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\develop\instantclient_12_1;C:\develop\Anaconda3;C:\develop\Anaconda3\Library\mingw-w64\bin;C:\develop\Anaconda3\Library\usr\bin;C:\develop\Anaconda3\Library\bin;C:\develop\Anaconda3\Scripts;
set "START=C:\workspace\ContactPortal_Flask\start.bat"
cd C:\workspace\ContactPortal_Flask
python -m flask run
then, The source code upload was successful, and turning on the flask server was also successful, but Jenkins was not marked Success and continued to load.
please help!!
I think the main problem here is that python -m flask run starts the server and will not finish until user hit Ctrl+C.
Since the target system is on Windows, you may want to create custom service and have jenkin start that service at the end instead. For service creation see https://learn.microsoft.com/en-us/troubleshoot/windows-client/deployment/create-user-defined-service And by starting this service (e.g. with NET START <service-name>) jenkin can finish, and flask can start running in the background.
Also for a production system, you may want to consider checking this and pick a proper web server instead of using the builtin web server provided by flask.

While creating python file on IIS with django Error 500

When I try to create a Python file (.py) in my Django application, I get an error 500. The file is created, and the code isn't the problem. I can create a text file or any other format. It would need to be a Python file because I need it for further steps.
I am using Windows 10 and running the Django application on IIS. Windows, IIS and Django are all up-to-date.
I already tried to add permission to the folder I will edit. I tested around with some other settings but haven't figured out the problem yet. I think it should be something with permission of IIS or Django.
This is my error message:
d:\django\virtualenv0\scripts\python.exe - The FastCGI process exited unexpectedly
Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module FastCgiModule
Notification ExecuteRequestHandler
Handler Python FastCGI
Error Code 0x00000000
Requested URL https://alpha.truningerag.ch:443/projects/realtest/
Physical Path D:\django\projects\realtest\
Logon Method Anonymous
Logon User Anonymous
More Information:
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
View more information »
Microsoft Knowledge Base Articles:
294807
I was able to solve my problem. I switch from IIS to Apache which didnt had any problem with creating a .py file anymore. After that I got an empty models file. The only thing left to do was to add in the absolute path python in the os.system(command).
Now everything works fine.
you need to check some below settings:
1)you enable iis CGI feature.
2)ensure pip and setup tools are fully upgraded:
python -m pip install pip --upgrade && pip install setuptools --upgrade
3)install the virtualenv tool:
pip install virtualenv
4)Activate the virtualenv so all our commands affect this interpreter.
C:\inetpub\wwwroot\mydjangoproject\> venv\scripts\activate
5)Configured the WFast CGI in iis.
6)"d:\django\virtualenv0\" path has iis_iusrs and iusr full control permission.
7)check iis application pool identity which server Django project.
for more detail, you could refer this link.
and please share your web.config file for more detail about the issue.

Cannot run app pool as service account

I had a Python Flask website that ran fine when I ran the app pool as my own account. When I tried changing this to a service account (which should have permissions), I get the following error
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has
occurred.
Most likely causes: •IIS received the request; however, an internal
error occurred during the processing of the request. The root cause of
this error depends on which module handles the request and what was
happening in the worker process when this error occurred. •IIS was not
able to access the web.config file for the Web site or application.
This can occur if the NTFS permissions are set incorrectly. •IIS was
not able to process configuration for the Web site or application.
•The authenticated user does not have permission to use this DLL. •The
request is mapped to a managed handler but the .NET Extensibility
Feature is not installed.
Detailed Error Information: Module FastCgiModule
Notification ExecuteRequestHandler
Handler Python Flask
Error Code 0x80070542
Requested URL http://qatools:80/
Physical Path D:\PythonWebService\QATools
Logon Method Anonymous
Logon User Anonymous
If I change it back to run as my own account, it works. Any thoughts?
FYI after some tinkering, I changed the app pool to run with Managed Pipeline mode of "Classic" instead of "Integrated" and it worked.

google-app-engine 1.9.19 deploy failure

When trying to deploy using the new Python GoogleAppEngine-1.9.19 in the form of the GAE launcher on Windows 7, I'm not asked to authenticate. Instead, I get a page for accepting GAE management, and then I'm running locally. Moreover, clicking the close box on the launcher does nothing and I have to kill it externally.
I don't understand the error messages or what to do. I don't have a file named old_run.py. I uninstalled 1.9.19 and reinstalled 1.9.18, and deploy works as always. Is 1.9.19 broken?
2015-04-15 11:27:47 Running command: "['C:\\Python27\\python.exe', '-u', 'C:\\Program Files (x86)\\Google\\google_appengine\\appcfg.py', '--oauth2', 'update', 'M:\\HP_Cdrive\\workspace\\glowscript']"
11:27 AM Application: glowscript; version: 1
11:27 AM Host: appengine.google.com
11:27 AM
Starting update of app: glowscript, version: 1
11:27 AM Getting current resource limits.
2015-04-15 11:27:50,838 WARNING old_run.py:88 This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=550516889912.apps.googleusercontent.com&access_type=offline
If your browser is on a different machine then exit and re-run
this application with the command-line parameter
--noauth_local_webserver
It's an issue with Google App Engine SDK, which doesn't allow the user authentication process to be completed, if local server is running.
Step 1. Stop the local server.
Step 2. Click on 'Deploy'
Step 3. You should get a message "The authentication flow has completed."
Step 4. Close the Window.
Step 5. Deploy again using Google App Engine. You should receive a message You
can close this window now.
you just have to shut down the server I use the google app engine luncher run and stop then deploy
Sorry about that - the tooling is in the process of changing. The docs should be updated shortly.
Try gcloud preview app deploy path-to/your.yaml --project myProjectID
You can deploy successfully in 1.9.19 by using command line.
appcfg.py update myapp/
Use an application-specific password instead of your regular account password.
In any case, you'll get a message that:
now the recommended way to log in is using OAuth2. See
https://developers.google.com/appengine/docs/python/tools/uploadinganapp#Python_
Password-less_login_with_OAuth2
If you are having problems with the redirection to localhost:8085, you can try to use wget from the server you're trying to authenticate, something like:
wget http://localhost:8085/?code=4/SOMELONGKEY#
After this you should be logged.
In my case, there was not version parameter in app.yaml file. When I add the parameter it has worked.
application: myappname
runtime: python27
api_version: 1
threadsafe: true
version: 1

google app engine upload 404

I'm trying to upload a simple "hello world" with google app engine (for python). Every time I do I get the following error
Error 404: --- begin server output ---
This application does not exist (app_id=u'sqeekytest').
--- end server output ---
I've checked and double checked that the app_id matches. I found a possible solution in the following thread however I am a complete noob at this and I'm not sure that I am doing this correctly.
This application does not exist (app_id=xxx)
It seems that the most common solution to this problem is to run appcfg.py update . --no_cookies. What I don't know is where I am running it. Is it in cmd, the python shell, the google cloud SDK shell that comes with the program? I've tried it a few different places and the only result I have gotten is the launching of pycharm. Either the solution is not working for me or I am doing something dumb (more likely). I cannot figure this out.
Thanks
Open a terminal or command prompt and cd to the directory of your project
$ cd path/to/project
Then from there do
$ appcfg.py update . --no_cookies
That assumes your app.yaml is in the root directory of your project. If it's in a different directory, specify it by
$ appcfg.py update /path/to/directory/where/app.yaml/is --no_cookies
It could be that appcfg.py is not in your PATH, in that case you could add it to the PATH or simply specify the location, also from within the root directory of your project.
$ path/to/google-cloud-sdk/bin/appcfg.py update . --no_cookies
This will open a webpage in a browser asking for permission and once you have given it it will automatically continue with the deploying process in the terminal/command prompt.

Categories

Resources