Guest User

Untitled

a guest
Dec 20th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import sys
  3.  
  4. sys.path.insert(0,'/var/www/bridge')
  5.  
  6. from bridge import app as application
  7.  
  8. <VirtualHost *:443>
  9. ServerName www.newocto.org
  10.  
  11. WSGIDaemonProcess bridge user=www-data group=www-data threads=5 home=/var/www/bridge/
  12. WSGIScriptAlias /bridge /var/www/bridge/bridge.wsgi
  13.  
  14. <Directory /var/www/bridge>
  15. WSGIProcessGroup bridge
  16. WSGIApplicationGroup %{GLOBAL}
  17.  
  18.  
  19. Require all granted
  20. </Directory>
  21.  
  22. <VirtualHost *:443>
  23. # The ServerName directive sets the request scheme, hostname and port that
  24. # the server uses to identify itself. This is used when creating
  25. # redirection URLs. In the context of virtual hosts, the ServerName
  26. # specifies what hostname must appear in the request's Host: header to
  27. # match this virtual host. For the default virtual host (this file) this
  28. # value is not decisive as it is used as a last resort host regardless.
  29. # However, you must set it for any further virtual host explicitly.
  30. ServerName www.newocto.org
  31. DocumentRoot /var/www/html
  32.  
  33. SSLEngine on
  34. SSLCertificateFile /etc/ssl/certs/newocto_org.crt
  35. SSLCertificateKeyFile /etc/ssl/private/newocto.key
  36. SSLCertificateChainFile /etc/ssl/certs/COMODORSAAddTrustCA.crt
  37. RewriteEngine On
  38. RewriteCond %{HTTPS} off
  39. RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
  40.  
  41. # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
  42. # error, crit, alert, emerg.
  43. # It is also possible to configure the loglevel for particular
  44. # modules, e.g.
  45. #LogLevel info ssl:warn
  46.  
  47. ErrorLog ${APACHE_LOG_DIR}/error.log
  48. CustomLog ${APACHE_LOG_DIR}/access.log combined
  49.  
  50. # For most configuration files from conf-available/, which are
  51. # enabled or disabled at a global level, it is possible to
  52. # include a line for only one particular virtual host. For example the
  53. # following line enables the CGI configuration for this host only
  54. # after it has been globally disabled with "a2disconf".
  55. #Include conf-available/serve-cgi-bin.conf
  56. </VirtualHost>
  57.  
  58. <VirtualHost *:80>
  59. ServerName newocto.org/
  60. Redirect / https://newocto.org/
  61. </VirtualHost>
  62.  
  63. # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
  64.  
  65. #!/usr/bin/python3
  66.  
  67. from flask import Flask
  68.  
  69.  
  70. app = Flask(__name__)
  71.  
  72. @app.route('/', methods =['POST'])
  73. def deliver():
  74. from flask import request
  75. raw=request.get_json(force=True)
  76. return raw
  77.  
  78. import mysql.connector
  79. dbconn= mysql.connector.connect(host='xxxx',port='3306',database='xx',user='root',password='xxx')
  80. cursor=dbconn.cursor()
  81. query="""insert into bridge_test2 (email) values ('{}')""".format(raw)
  82. cursor.execute(query)
  83. dbconn.commit()
  84. dbconn.close()
  85.  
  86.  
  87. if __name__ == '__main__':
  88. app.run()
Add Comment
Please, Sign In to add comment