Run "git pull" for a Django project running on Windows Server 2016 IIS - django

My current set up has a Django project running on Windows 2016 IIS.
The project is hosted on GitHub for collaboration and I would like to set up a GitHub webhook so whenever there's a push to master branch from any of the collaborators, the IIS Server will run a "git pull" to update the project on the server.
What is normally the setup for this?
What I have tried so far is to create an endpoint in the Django project, this endpoint whenever called will run Python subprocess to run "git pull" command in the project itself. However, whenever I run it, it get a 500 response from IIS.

Thanks #VonC for helping.
I have looked to the log (which was the one in XML) but it wasn't much help.
What I'm posting here was my workaround, not exactly to the answer for the question above.
I used django-background-tasks to add the command subprocess.run(['git', 'pull']) as a task to run later (after a few seconds after that by the #background decorator).

Error 500 means the IIS server throws an error.
You need to check said IIS server logs in order to check at what point in the execution of the webhook endpoint script the error occurs.

Related

Django app on Windows Server 2012 - HTTP Error 500.0 - The FastCGI process exited unexpectedly

I setup a django "hello world" app IIS (Windows Server 2012). The application is run successfully using the Django web server. However, when I tried to install in on IIS (following the instructions provided here) I get an HTTP 500 error with the message "python.exe - The FastCGI process exited unexpectedly".
I have seen numerous related posts on stackoverflow, but nothing seems to work for me. Based on the guidance
I have checked file permissions on both the app and virtual environment folder but they in my opinion this should not be the issue as the users IUSR and IIS_IUSRS can Read & execute, Read and List folder contents.
I have tried also to run wfastcgi-enable based on the instructions provided by this post but I get the error "ensure your user has sufficient privileges and try again". Please note that I tried running it both from an "elevated" command line and also power shell with no results.
I have reinstalled python to make sure it is installed for "all users" (as suggested by this post) but I get an error "0x80070659 - This installation is forbidden by system policy".
I looked in the Event viewer but I could not find something useful.
My questions:
Is there a specific log that I should check? How could I find it?
My django app does not have a web.config file. Should I create one?
My setup: Windows Server 2012 R2, IIS 8.5, Python 3.9.1

Django Deployment on windows

I am learning python and Django now. I have a question related to deploying Django project on windows 7. I know how to start the test server in django and see the project. But I have to do start the server manually every time I restart the PC. Also I have to keep the terminal window open.
Consider the below scenario for php projects.
We copy and paste the php files in htdocs or www folder in apache server and access them using the respected url. Web Server is running in the background. We dont have to start the server on windows restart.
Is something similar possible with Django on apache or any other server?
If yes, how should I go about it?
Thanks in advance.
For anyone stumbling around for an answer to a similar problem with deploying Django on a Windows server, here is a guide
Deploy Django with Apache and mod_wsgi on Windows Server 2019
To have Apache24 service automatically run on startup, make the changes in Windows Services dialog.

unable to deploy application on cloudfoundry raising error 404 Not Found

i am trying to deploy spring application on cloudfoundry.but as a build war file of project using mvn package command.after that i used vmc push --appname target(directory)
i finished all the steps that need to push on cloudfoundry.
finally i got message uploading application-name....ok
then i entered command vmc apps
then it shows all my pushed applications....
there was url(http://cloudapp-project-master.cloudfoundry.com/) for my deployed application.
which i copied and placed in browser then it giving me 404 Not Found nginx
i don't know where is the problem....
Please help me to get out of this.
advanced thanks....
Can you look at the logs folder to see if the files there give more information.
vmc logs <app-name>
or
vmc files <app-name> logs/stderr.log
vmc files <app-name> logs/stdout.log
What is the status of the app when you run vmc apps? I would recommend you to file a ticket at http://support.cloudfoundry.com with detailed information about the issue and maybe share the project so that they can reproduce the issue easily. You will need the account registered in cf.com to be able to login.

Jetty won't work: Is there a way to purge it?

I'm a Jetty newb, but it's making life hell. First there was an Eclipse problem I described in another question. Rather than waste time on it, I decided to just run Jetty from the console. I started off importing a sample Tapestry project and was able to run it fine... the project is on the Tapestry page and is called tutorial1
I began work on my own project then and began introducing new functionality to it. At some point it stopped working. I tried backtracking my project to get it to a working state but every time I requested the home page it would just hang. At this point I still thought it was my fault, though I did think a more graceful error message would have been nice than the it attempting to load for a minute followed by a server timeout error.
I then shutdown jetty and attempted to load up the imported sample project using mvn jetty:run in my tutorial1 project directory. it doesn't work either! When I try going to localhost:8080/tutorial1 or the URL of my project the jetty console does show any output, almost as if it's not receiving the request.
I rebooted my entire machine but that doesn't help. I am not familiar with jetty architecture and am unsure if there is a way I can purge all my files from the jetty web application directory.
Any ideas?
Cliffs Notes:
Downloaded Tapestry Archetype project with maven.
Executed jetty from the command line using mvn jetty:run
Started new project
Executed jetty from the command line using mvn jetty:run
Modified new project
Error occurred, attempted fix and restarted Jetty (Ctrl + C, followed by mvn jetty:run)
Jetty restarted, but did not seem to handle requests for any pages
Tried starting jetty from Archetype project, experienced the same problem
If your project didn't deploy correctly, jetty won't serve any pages (they will either return 404 or some error in the 500s).
Look at the log folder and check if it is getting correctly deployed.

django non-rel rollback

I cancelled a deployment to GAE while using django non-rel's manage.py deploy.
Now when I try to redeploy it says Another transaciton is already in progress and use appcfg to rollback.
But django non-rel doesn't have appcfg.py so how can I rollback or fix this issue?
I've scoured the internet and can't find any answers. I've waited about half an hour and it still displays this message.
manage.py deploy calls appcfg.py in order to deploy.
appcfg.py is in the SDK. you must have the SDK installed somewhere if "manage.py deploy" is working. you can look around for it, or download the SDK again.
There's no reason you don't have access to appcfg.py
If you need more help finding it, add details about what platform you're running on, where you installed the appengine SDK and where your python folder is.
What do you mean by "I don't have access to appcfg.py"?
Try going to cmd (for windows), navigate to your app directory, and type in the following:
appcfg.py rollback .
Hit return (enter key) and see if that works. If not, what does it display?