Deploying django app to digital ocean unsuccessful (502 Bad Gateway) - django

Good day guys, I am in a bit of a mess here with deploying a Django app to the digital ocean using Gunicorn and Ngnix. I am following the steps in a video tutorial I bought on udemy, where we are following a link https://gist.github.com/bradtraversy/cfa565b879ff1458dba08f423cb01d71#disable-root-login. while following the tutorial, everything worked to the point before I set up gunicorn, which means I was able to see the website through the IP address. but, only that the static files were not handled by Nginx and I was running the server using python manage.py runserver 0.0.0.0:8000 when I was at this point https://gist.github.com/bradtraversy/cfa565b879ff1458dba08f423cb01d71#run-server. when I followed the step and configured gunicorn and Nginx, I was getting 502 Bad Gateway when I visited using the IP address.
I was wondering why I was getting this issue, and I noticed that when I checked the status of gunicorn using sudo systemctl status gunicorn.socket I was getting:
gunicorn.socket - gunicorn socket
Loaded: loaded (/etc/systemd/system/gunicorn.socket; enabled; vendor preset: enabled)
Active: failed (Result: service-start-limit-hit) since Fri 2020-02-28 03:03:11 UTC; 7s ago
Listen: /run/gunicorn.sock (Stream)
here is a link to the project I was trying to add to the server if needed https://github.com/opeodedeyi/medxFinal
when i run sudo nginx -t i get
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
just incase this is how my gunicorn service file is set up
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=djangoadmin
Group=www-data
WorkingDirectory=/home/djangoadmin/pyapps/medxFinal
ExecStart=/home/djangoadmin/pyapps/medxFinal/venv/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
medx.wsgi:application
[Install]
WantedBy=multi-user.target
and just the explain how my folder is structured, inside the medxFinal is where the venv and medx folders are, inside that medx folder is where the manage.py is and other folders including another medx folder are found, inside the last medx is where the settings.py, wsgi, and first URL is.
running sudo tail -F /var/log/nginx/error.log i see this
2020/02/28 07:33:51 [error] 15252#15252: *12 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 95.217.130.88, server: 64.225.59.162, request: "POST //vendor/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock://vendor/phpunit/src/Util/PHP/eval-stdin.php", host: "64.225.59.162", referrer: "https://www.google.com/"
2020/02/28 07:33:52 [error] 15252#15252: *12 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 95.217.130.88, server: 64.225.59.162, request: "POST //wp-content/plugins/cloudflare/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock://wp-content/plugins/cloudflare/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php", host: "64.225.59.162", referrer: "https://www.google.com/"
2020/02/28 07:33:52 [error] 15252#15252: *12 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 95.217.130.88, server: 64.225.59.162, request: "POST //wp-content/plugins/dzs-videogallery/class_parts/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock://wp-content/plugins/dzs-videogallery/class_parts/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php", host: "64.225.59.162", referrer: "https://www.google.com/"
2020/02/28 07:33:52 [error] 15252#15252: *12 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 95.217.130.88, server: 64.225.59.162, request: "POST //wp-content/plugins/jekyll-exporter/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock://wp-content/plugins/jekyll-exporter/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php", host: "64.225.59.162", referrer: "https://www.google.com/"
2020/02/28 07:33:52 [error] 15252#15252: *12 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 95.217.130.88, server: 64.225.59.162, request: "POST //wp-content/plugins/mm-plugin/inc/vendors/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock://wp-content/plugins/mm-plugin/inc/vendors/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php", host: "64.225.59.162", referrer: "https://www.google.com/"
2020/02/28 07:33:52 [error] 15252#15252: *12 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 95.217.130.88, server: 64.225.59.162, request: "POST //www/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock://www/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php", host: "64.225.59.162", referrer: "https://www.google.com/"
2020/02/28 08:58:29 [error] 15252#15252: *45 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 46.119.158.129, server: 64.225.59.162, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "64.225.59.162:80"
2020/02/28 09:28:40 [error] 15252#15252: *47 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 189.51.114.40, server: 64.225.59.162, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "64.225.59.162:80"
2020/02/28 10:01:41 [error] 15252#15252: *51 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 105.112.56.238, server: 64.225.59.162, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "64.225.59.162"
2020/02/28 10:07:46 [error] 15252#15252: *54 connect() to unix:/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 78.165.205.193, server: 64.225.59.162, request: "GET / HTTP/1.1", upstream: "http://unix:/run/gunicorn.sock:/", host: "64.225.59.162:80"
running sudo journalctl -u nginx
-- Logs begin at Thu 2020-02-27 03:32:45 UTC, end at Fri 2020-02-28 11:18:20 UTC. --
Feb 27 10:41:35 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 10:41:35 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 10:41:35 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 13:26:42 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 13:26:42 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 13:26:42 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 13:26:42 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 13:26:42 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 13:29:33 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 13:29:33 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 13:29:33 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 13:29:33 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 13:29:33 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 13:31:13 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 13:31:13 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 13:31:13 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 13:31:13 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 13:31:13 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 13:50:26 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 13:50:26 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 13:50:26 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 13:50:26 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 13:50:26 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 13:51:21 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 13:51:21 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 13:51:21 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 13:51:21 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 13:51:21 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 13:57:12 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 13:57:12 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 13:57:12 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 13:57:12 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 13:57:12 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 14:54:08 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 14:54:09 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 14:54:09 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 14:54:09 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 14:54:09 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 27 14:56:15 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 27 14:56:15 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 27 14:56:15 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 27 14:56:15 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 27 14:56:15 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.
Feb 28 03:29:52 ubuntu1 systemd[1]: Stopping A high performance web server and a reverse proxy server...
Feb 28 03:29:52 ubuntu1 systemd[1]: Stopped A high performance web server and a reverse proxy server.
Feb 28 03:29:52 ubuntu1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 28 03:29:52 ubuntu1 systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 28 03:29:52 ubuntu1 systemd[1]: Started A high performance web server and a reverse proxy server.

Did you check your gunicorn.service and gunicorn.socket file?
Did you add the correct user name for user in gunicorn.service file?
[Service]
User=<yourusername>
Group=www-data
if so try these commands
curl --unix-socket /run/gunicorn.sock localhost
if the above command prints out the html page in the terminal, then you are good to go or else change the gunicorn.service file and try again
sudo systemctl daemon-reload
sudo systemctl restart gunicorn
I think your service file should be like this, based on your github repo
WorkingDirectory=/home/djangoadmin/pyapps/medxFinal/medx

Try sudo tail -F /var/log/nginx/error.log
and refresh to see the updates in the log. From the result it is easy to find a solution

Related

Redis wont start: Could not create server TCP listening socket 127.0.0.1:6379: bind: Address already in use

I have installed redis in my AWS server. I have followed this: https://www.digitalocean.com/community/tutorials/how-to-install-secure-redis-centos-7
$ systemctl start redis.service
$ systemctl enable redis
-> Created symlink /etc/systemd/system/multi-user.target.wants/redis.service → /usr/lib/systemd/system/redis.service.
$ systemctl status redis.service
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf
Active: failed (Result: exit-code) since Wed 2020-08-26 02:28:25 UTC; 10s ago
Main PID: 5012 (code=exited, status=1/FAILURE)
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: Starting Redis persistent key-value database...
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: Started Redis persistent key-value database.
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: redis.service: Failed with result 'exit-code'.
And when I check the /var/log/redis/redis.log this is what I see:
5012:C 26 Aug 2020 02:28:25.574 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5012:C 26 Aug 2020 02:28:25.574 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=5012, just started
5012:C 26 Aug 2020 02:28:25.574 # Configuration loaded
5012:C 26 Aug 2020 02:28:25.574 * supervised by systemd, will signal readiness
5012:M 26 Aug 2020 02:28:25.575 # Could not create server TCP listening socket 127.0.0.1:6379: bind: Address already in use
And upon checking the ports:
$ netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 2812/redis-server *
tcp6 0 0 :::6379 :::* LISTEN 2812/redis-server *
This is showing the port 6379 is actually being used by redis-server.
So why cannot it start then?
Do I need to add any inbound/outbound rules in AWS? Please help.
UPDATE
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd command on terminal returns bash: /etc/redis.conf: Permission denied. Looks like need to give right permission to /etc/redis.conf file.
$ ls -l /etc/redis.conf
-rw-r-----. 1 redis redis 62189 Aug 26 03:04 /etc/redis.conf
So what permission do I need to give here? Who should own this file?

NGINX failed to work while configuring server for subdomain

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
Prior to this prompt, the server was working fine, but when I tried to config the server for subdomain it failed to work with this error.
Also for detailed error ...
[ec2-user#ip--------- conf.d]$ systemctl status nginx.service
? nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2020-07-07 06:03:04 UTC; 4min 17s ago
Process: 71445 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 71444 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 70298 (code=exited, status=0/SUCCESS)
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy serv>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal nginx[71445]: nginx: [emerg] unexpected end of file, expec>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal nginx[71445]: nginx: configuration file /etc/nginx/nginx.c>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: nginx.service: Control process exited, code=ex>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: nginx.service: Failed with result 'exit-code'.
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: Failed to start The nginx HTTP and reverse pro>
lines 1-13/13 (END)
You can always check configuration errors by using this command :
nginx -T
before launch a catastrophic restart :)
You have an error unexpected end of file, check the syntax of your NGINX configuration as it is likely that you have a broken file.
The likely candidate is forgetting to close a } character.

Systemctl with gunicorn permission denied

I've been working on systemctl for a while and it's just not working.
I have tested with gunicorn and it works perfectly, but when I'm doing this
systemctl daemon-reload
systemctl enable flaskapp
systemctl start flaskapp
However, I've been getting issues like this
Dec 2 16:17:15 localhost systemd[1]: Started flaskapp.
Dec 2 16:17:15 localhost systemd[2130]: flaskapp.service: Failed at step EXEC spawning /home/flaskappuser/flaskapp/flaskvenv/bin/gunicorn: Permission denied
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Main process exited, code=exited, status=203/EXEC
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Unit entered failed state.
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Failed with result 'exit-code'.
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Service hold-off time over, scheduling restart.
Dec 2 16:17:15 localhost systemd[1]: Stopped flaskapp.
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Start request repeated too quickly.
Dec 2 16:17:15 localhost systemd[1]: Failed to start flaskapp.
Dec 2 16:17:21 localhost systemd[1]: supervisor.service: Service hold-off time over, scheduling restart.
Dec 2 16:17:21 localhost systemd[1]: Stopped Supervisor process control system for UNIX.
Dec 2 16:17:21 localhost systemd[1]: Started Supervisor process control system for UNIX.
I tried with sudo and it doesn't work either. I have searched everything online but no result. Can anyone help me with this?

nginx cannot start on redhat server

I am trying to install nginx on a rhel 7 and it says process doesn't start. Following is the log.
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Starting nginx -
high performance web server...**
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: the
configuration file /etc/nginx/nginx.conf syntax is ok
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: [emerg]
open() "/mnt/nginx_logs/pubstore/access.log" failed (13: Permission
denied)
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx:
configuration file /etc/nginx/nginx.conf test failed
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: nginx.service:
control process exited, code=exited status=1
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Failed to start
nginx - high performance web server.
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Unit
nginx.service entered failed state.**
The permission of the file access log is as follows. I have given permission but still it doesn't start.
-rwxrwxrwx. 1 nginx nginx 0 Nov 13 02:07 access.log
-rwxrwxrwx. 1 nginx nginx 0 Nov 13 02:07 error.log
The installation is done on a puppet agent on amazon ec2 instance
This line:
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: [emerg] open() "/mnt/nginx_logs/pubstore/access.log" failed (13: Permission denied)
Tells you that the user you are running nginx as, does not have access to write to the log file its configured to write to.
Since the logs are being stored in a non-standard location, you will likely have to ensure that the directory you want to store logs in, is writable by the same user that nginx is running as.

OpenShift Error The requested URL / was not found on this server

I've been trying to deploy a flask app on openshift. I tested the website and it runs just fine on the development server (both by typing python app.py and manage.py runserver), I uploaded the project to github and created the app using this command from terminal:
rhc create-app marcsantiago python-2.7 --from-code=https://github.com/marcsantiago/personalwebsite.git
The app seems to be created without a problem. The issue occurs when I try and visit the created url:
http://marcsantiago-mywebappsflask.rhcloud.com
I receive a not found error The requested URL / was not found on this server.
I don't understand what i did wrong or how to fix it so that the website it live. It is a simple website, which uses no databases.
Could someone please help me resolve this issue?
this the postgresql.log information, though i'm not sure how relevant it is since i don't use a database, python.log is below
2015-07-22 02:05:44 GMT LOG: could not bind socket for statistics collector: Permission denied
2015-07-22 02:05:44 GMT LOG: trying another address for the statistics collector
2015-07-22 02:05:44 GMT LOG: could not bind socket for statistics collector: Cannot assign requested address
2015-07-22 02:05:44 GMT LOG: disabling statistics collector for lack of working socket
2015-07-22 02:05:44 GMT WARNING: autovacuum not started because of misconfiguration
2015-07-22 02:05:44 GMT HINT: Enable the "track_counts" option.
2015-07-22 02:05:44 GMT LOG: database system was shut down at 2013-05-21 05:07:11 GMT
2015-07-22 02:05:44 GMT LOG: database system is ready to accept connections
2015-07-22 02:05:48 GMT LOG: received smart shutdown request
2015-07-22 02:05:48 GMT LOG: shutting down
2015-07-22 02:05:48 GMT LOG: database system is shut down
2015-07-22 02:06:04 GMT LOG: could not bind socket for statistics collector: Permission denied
2015-07-22 02:06:04 GMT LOG: trying another address for the statistics collector
2015-07-22 02:06:04 GMT LOG: could not bind socket for statistics collector: Cannot assign requested address
2015-07-22 02:06:04 GMT LOG: disabling statistics collector for lack of working socket
2015-07-22 02:06:04 GMT WARNING: autovacuum not started because of misconfiguration
2015-07-22 02:06:04 GMT HINT: Enable the "track_counts" option.
2015-07-22 02:06:04 GMT LOG: database system was shut down at 2015-07-22 02:05:48 GMT
2015-07-22 02:06:04 GMT LOG: database system is ready to accept connections
python.log
[Tue Jul 21 22:06:07 2015] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:openshift_t:s0:c6,c294
[Tue Jul 21 22:06:07 2015] [notice] Digest: generating secret for digest authentication ...
[Tue Jul 21 22:06:07 2015] [notice] Digest: done
[Tue Jul 21 22:06:07 2015] [notice] Apache/2.2.15 (Unix) mod_wsgi/3.4 Python/2.7.8 configured -- resuming normal operations
(98)Address already in use: make_sock: could not bind to address 127.12.133.129:8080
no listening sockets available, shutting down
Unable to open logs
[Tue Jul 21 22:07:01 2015] [error] [client 127.12.133.129] Target WSGI script not found or unable to stat: /var/lib/openshift/55aefa434382ecece2000001/app-root/runtime/repo/wsgi, referer: http://stackoverflow.com/questions/31551797/openshift-error-the-requested-url-was-not-found-on-this-server/31552667
67.84.182.205 - - [21/Jul/2015:22:07:01 -0400] "GET / HTTP/1.1" 404 304 "http://stackoverflow.com/questions/31551797/openshift-error-the-requested-url-was-not-found-on-this-server/31552667" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3"
[Tue Jul 21 22:08:49 2015] [error] [client 127.12.133.129] Target WSGI script not found or unable to stat: /var/lib/openshift/55aefa434382ecece2000001/app-root/runtime/repo/wsgi, referer: http://stackoverflow.com/questions/31551797/openshift-error-the-requested-url-was-not-found-on-this-server/31552667?noredirect=1
124.32.215.10 - - [21/Jul/2015:22:08:49 -0400] "GET / HTTP/1.1" 404 304 "http://stackoverflow.com/questions/31551797/openshift-error-the-requested-url-was-not-found-on-this-server/31552667?noredirect=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12"
[Tue Jul 21 22:08:50 2015] [error] [client 127.12.133.129] Target WSGI script not found or unable to stat: /var/lib/openshift/55aefa434382ecece2000001/app-root/runtime/repo/wsgi, referer: http://marcsantiago-mywebappsflask.rhcloud.com/
124.32.215.10 - - [21/Jul/2015:22:08:50 -0400] "GET /favicon.ico HTTP/1.1" 404 315 "http://marcsantiago-mywebappsflask.rhcloud.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12"
[Tue Jul 21 22:10:25 2015] [error] [client 127.12.133.129] Target WSGI script not found or unable to stat: /var/lib/openshift/55aefa434382ecece2000001/app-root/runtime/repo/wsgi
10.99.163.186 - - [21/Jul/2015:22:10:25 -0400] "HEAD / HTTP/1.1" 404 - "-" "Ruby"
10.99.163.186 - - [21/Jul/2015:22:10:25 -0400] "HEAD / HTTP/1.1" 404 - "-" "Ruby"
[Tue Jul 21 22:10:25 2015] [error] [client 127.12.133.129] Target WSGI script not found or unable to stat: /var/lib/openshift/55aefa434382ecece2000001/app-root/runtime/repo/wsgi
sorry for how messy it looks, couldn't think of a better way to share the logs other than pasting them in.
Have you tried reading through the section of the Developer Portal that is about using Flask on OpenShift Online?
https://developers.openshift.com/en/python-flask.html
The domain is not pointing to any server.
This is most likely an issue in your configuration on Openshift, an error in their server configuration or a mistyping of the URL on your side.
Contact Openshift or check their logs.
Edit:
Looking at the new logs, it becomes clear that the server can't find your WSGI app. You mention that it is called app.py, but the server may be looking for something else. The more common file name would be application.py. Check your configuration at OpenShift and adjust the WSGI application file name accordingly.