This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import logging | |
logging.basicConfig(stream=sys.stderr) | |
sys.path.insert(0,"/var/www/catalogApp/catalog/") | |
from catalog import app as application | |
application.secret_key = 'super_secret_key' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(venv) grader@ip-172-26-15-250:/var/www/catalogApp/catalog$ pip show flask | |
Name: Flask | |
Version: 1.0.2 | |
Summary: A simple framework for building complex web applications. | |
Home-page: https://www.palletsprojects.com/p/flask/ | |
Author: Armin Ronacher | |
Author-email: armin.ronacher@active-4.com | |
License: BSD | |
Location: /var/www/catalogApp/catalog/venv/lib/python2.7/site-packages | |
Requires: Jinja2, itsdangerous, Werkzeug, click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo tail -10 /var/log/apache2/error.log | |
[Fri Aug 31 17:37:34.551181 2018] [mpm_event:notice] [pid 18421:tid 139974958294912] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations | |
[Fri Aug 31 17:37:34.551199 2018] [core:notice] [pid 18421:tid 139974958294912] AH00094: Command line: '/usr/sbin/apache2' | |
[Fri Aug 31 17:37:43.778862 2018] [wsgi:error] [pid 18425:tid 139974687041280] [client 197.255.174.176:20682] mod_wsgi (pid=18425): Target WSGI script '/var/www/catalogApp/catalog/catalog.wsgi' cannot be loaded as Python module. | |
[Fri Aug 31 17:37:43.778889 2018] [wsgi:error] [pid 18425:tid 139974687041280] [client 197.255.174.176:20682] mod_wsgi (pid=18425): Exception occurred processing WSGI script '/var/www/catalogApp/catalog/catalog.wsgi'. | |
[Fri Aug 31 17:37:43.778911 2018] [wsgi:error] [pid 18425:tid 139974687041280] [client 197.255.174.176:20682] Traceback (most recent call last): | |
[Fri Aug 31 17:37:43.778926 2018] [wsgi:error] [pid 18425:tid 139974687041280] [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo tail -10 /var/log/apache2/error.log | |
[Wed Aug 29 10:59:44.689332 2018] [wsgi:error] [pid 15762:tid 140278103000832] [client 197.242.96.221:4420] Traceback (most recent call last): | |
[Wed Aug 29 10:59:44.689347 2018] [wsgi:error] [pid 15762:tid 140278103000832] [client 197.242.96.221:4420] File "/var/www/catalog/catalog.wsgi", line 7, in <module> | |
[Wed Aug 29 10:59:44.689390 2018] [wsgi:error] [pid 15762:tid 140278103000832] [client 197.242.96.221:4420] from catalogApp import app as application | |
[Wed Aug 29 10:59:44.689399 2018] [wsgi:error] [pid 15762:tid 140278103000832] [client 197.242.96.221:4420] File "/var/www/catalog/catalogApp/__init__.py", line 12, in <module> | |
[Wed Aug 29 10:59:44.689484 2018] [wsgi:error] [pid 15762:tid 140278103000832] [client 197.242.96.221:4420] from oauth2client.client import flow_from_clientsecrets | |
[Wed Aug 29 10:59:44.689492 2018] [wsgi:error] [pid 15762:tid 140278103000832] [client 197.242.96.221:4420] File "/usr/local/lib/python2.7/dist-packages/oauth2client/cl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install the Python PostgreSQL adapter psycopg: sudo apt-get install python-psycopg2 | |
Install PostgreSQL: sudo apt-get install postgresql postgresql-contrib | |
To check, no remote connections are allowed : sudo vim /etc/postgresql/9.3/main/pg_hba.conf | |
open database_setup.py using : sudo nano database_setup.py | |
update the create_engine line: python engine = create_engine('postgresql://catalog:catalog-pw@localhost/catalog') | |
Update the create_engine line in project.py and lotsofmenus.py too. | |
move the project.py file to init.py file : mv application.py init.py | |
Change to default user postgres: sudo su - postgre | |
Connect to the system: psql | |
Create user catalog: CREATE USER catalog WITH PASSWORD 'catalog-pw'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/var/www/catalog/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context | |
context) | |
File "/var/www/catalog/venv/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute | |
cursor.execute(statement, parameters) | |
sqlite3.OperationalError: attempt to write a readonly database | |
The above exception was the direct cause of the following exception: | |
Traceback (most recent call last): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(venv) grader@ip-172-26-8-30:/var/log/apache2$ sudo cat error.log | |
[Fri Aug 17 11:37:33.299295 2018] [wsgi:warn] [pid 22149] mod_wsgi: Compiled for Python/3.5.1+. | |
[Fri Aug 17 11:37:33.299343 2018] [wsgi:warn] [pid 22149] mod_wsgi: Runtime using Python/3.5.2. | |
[Fri Aug 17 11:37:33.299358 2018] [core:warn] [pid 22149] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run? | |
[Fri Aug 17 11:37:33.300670 2018] [mpm_prefork:notice] [pid 22149] AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations | |
[Fri Aug 17 11:37:33.300684 2018] [core:notice] [pid 22149] AH00094: Command line: '/usr/sbin/apache2' | |
[Fri Aug 17 11:37:39.384825 2018] [mpm_prefork:notice] [pid 22149] AH00171: Graceful restart requested, doing restart | |
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message | |
[Fri Aug 17 11:37:39.414823 2018] [wsgi:warn] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(venv) grader@ip-172-26-8-30:/usr/local/lib/python3.5/dist-packages$ ls | |
click psycopg2 | |
click-6.7.dist-info psycopg2-2.7.5.dist-info | |
flask pyasn1_modules | |
Flask-1.0.2.dist-info pyasn1_modules-0.2.2.dist-info | |
httplib2 __pycache__ | |
httplib2-0.11.3.egg-info rsa | |
itsdangerous-0.24.egg-info rsa-3.4.2.dist-info | |
itsdangerous.py sqlalchemy | |
jinja2 SQLAlchemy-1.2.10.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grader@ip-172-26-8-30:/var/log/apache2$ sudo cat error.log | |
[Fri Aug 17 11:37:33.299295 2018] [wsgi:warn] [pid 22149] mod_wsgi: Compiled for Python/3.5.1+. | |
[Fri Aug 17 11:37:33.299343 2018] [wsgi:warn] [pid 22149] mod_wsgi: Runtime using Python/3.5.2. | |
[Fri Aug 17 11:37:33.299358 2018] [core:warn] [pid 22149] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run? | |
[Fri Aug 17 11:37:33.300670 2018] [mpm_prefork:notice] [pid 22149] AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations | |
[Fri Aug 17 11:37:33.300684 2018] [core:notice] [pid 22149] AH00094: Command line: '/usr/sbin/apache2' | |
[Fri Aug 17 11:37:39.384825 2018] [mpm_prefork:notice] [pid 22149] AH00171: Graceful restart requested, doing restart | |
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message | |
[Fri Aug 17 11:37:39.414823 2018] [wsgi:warn] [pid 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grader@ip-172-26-8-30:/var/log/apache2$ sudo cat error.log | |
[Fri Aug 17 11:37:33.299295 2018] [wsgi:warn] [pid 22149] mod_wsgi: Compiled for Python/3.5.1+. | |
[Fri Aug 17 11:37:33.299343 2018] [wsgi:warn] [pid 22149] mod_wsgi: Runtime using Python/3.5.2. | |
[Fri Aug 17 11:37:33.299358 2018] [core:warn] [pid 22149] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run? | |
[Fri Aug 17 11:37:33.300670 2018] [mpm_prefork:notice] [pid 22149] AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations | |
[Fri Aug 17 11:37:33.300684 2018] [core:notice] [pid 22149] AH00094: Command line: '/usr/sbin/apache2' | |
[Fri Aug 17 11:37:39.384825 2018] [mpm_prefork:notice] [pid 22149] AH00171: Graceful restart requested, doing restart | |
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message | |
[Fri Aug 17 11:37:39.414823 2018] [wsgi:warn] [pid 2 |