Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 10.44 KB | None | 0 0
  1. # This file contains the WSGI configuration required to serve up your
  2. # web application at http://crosstalk.pythonanywhere.com/
  3. # It works by setting the variable 'application' to a WSGI handler of some
  4. # description.
  5. #
  6.  
  7. # +++++++++++ GENERAL DEBUGGING TIPS +++++++++++
  8. # getting imports and sys.path right can be fiddly!
  9. # We've tried to collect some general tips here:
  10. # https://www.pythonanywhere.com/wiki/DebuggingImportError
  11.  
  12.  
  13. # +++++++++++ HELLO WORLD +++++++++++
  14. # A little pure-wsgi hello world we've cooked up, just
  15. # to prove everything works.  You should delete this
  16. # code to get your own working.
  17.  
  18.  
  19. HELLO_WORLD = """
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. <!DOCTYPE html>
  31. <html>
  32.  
  33.    <head>
  34.        <title>E-Chat - Online Chat Rooms For Everyone | Free Chat</title>
  35.        <meta name="description" content="E-chat is a chat rooms website, where people talk online with each other on various topics.">
  36.  
  37. <!-- facebook tags -->
  38.        <meta property="og:image" content="http://www.e-chat.co/Resources/Icons/Misc/EchatFacebookShareIcon.png"/>
  39.        <meta property="og:title" content="E-Chat - Online Chat Rooms For Everyone | Free Chat"/>
  40.        <meta property="og:description" content="E-chat is a chat rooms website, where people talk online with each other on various topics."/>
  41.        <meta property="og:url" content="http://www.e-chat.co"/>
  42.        <meta property="og:type" content="website"/>
  43.  
  44.        <link rel="shortcut icon" href="http://www.e-chat.co/Resources/Icons/Misc/EchatFavicon.png"/>
  45.  
  46.        <link rel="stylesheet" href="http://www.e-chat.co/styles/website/website.index.css?v=1485338478727">
  47.  
  48.        <script src="http://www.e-chat.co/scripts/lib/jquery.1.11.1.min.js?v=1485338478727"></script>
  49.        <script src="http://www.e-chat.co/scripts/shared/google.analytics.js?v=1485338478727"></script>
  50.        <script src="http://www.e-chat.co/scripts/shared/global.utils.js?v=1485338478727"></script>
  51.  
  52.        <script src="http://www.e-chat.co/scripts/shared/authentication/authentication.controller.js?v=1485338478727"></script>
  53.        <script src="http://www.e-chat.co/scripts/shared/authentication/authentication.interface.js?v=1485338478727"></script>
  54.  
  55.        <script>
  56.            $(document).ready(function()
  57.             {
  58.                com.echat.shared.authentication.Interface.initializeInterfaceCallbacks();
  59.                com.echat.shared.authentication.Interface.initializeStartupRoutine();
  60.            });
  61.        </script>
  62.    </head>
  63.  
  64.    <body>
  65.        <div id="MainWrapper">
  66.            <div id="MainWrapperRelative">
  67.                <img id="EchatMainLogo" src="http://www.e-chat.co/Resources/Icons/Misc/EchatLogo.png" alt="Chat rooms logo - E-Chat"/>
  68.  
  69.                <div id="LeftSection">
  70.                    <h1 id="BenefitsTitle">E-Chat</h1>
  71.                    <h2 id="BenefitsTitleSecondary">Chat with anyone you want, about anything you want, free.</h2>
  72.  
  73.                    <div class="BenefitWrapper">
  74.                        <img class="BenefitImage" src="http://www.e-chat.co/Resources/Icons/Misc/registerIconYesTick.png" alt="Chat Benefit Icon"/>
  75.                        <span class="BenefitText">
  76.                            Meet new people who share the same interests as you do.
  77.                        </span>
  78.                    </div>
  79.  
  80.                    <div class="BenefitWrapper">
  81.                        <img class="BenefitImage" src="http://www.e-chat.co/Resources/Icons/Misc/registerIconYesTick.png" alt="Chat Benefit Icon"/>
  82.                        <span class="BenefitText">
  83.                            Make your own chat room with full control over it.
  84.                        </span>
  85.                    </div>
  86.  
  87.                    <div class="BenefitWrapper">
  88.                        <img class="BenefitImage" src="http://www.e-chat.co/Resources/Icons/Misc/registerIconYesTick.png" alt="Chat Benefit Icon"/>
  89.                        <span class="BenefitText">
  90.                            Add a chat box to another website (<a href="http://www.e-chat.co/widget/example">www.e-chat.co/widget/example</a>).
  91.                        </span>
  92.                    </div>
  93.  
  94.                    <div class="BenefitWrapper">
  95.                        <img class="BenefitImage" src="http://www.e-chat.co/Resources/Icons/Misc/registerIconYesTick.png" alt="Chat Benefit Icon"/>
  96.                        <span class="BenefitText">
  97.                            All chat rooms run very fast, and require no plug-ins (no flash, no java).
  98.                        </span>
  99.                    </div>
  100.  
  101.                    <div class="BenefitWrapper">
  102.                        <img class="BenefitImage" src="http://www.e-chat.co/Resources/Icons/Misc/registerIconYesTick.png" alt="Chat Benefit Icon"/>
  103.                        <span class="BenefitText">
  104.                            It was, is, and always will be free. Thanks!
  105.                        </span>
  106.                    </div>
  107.                </div>
  108.  
  109.                <div id="RightSection">
  110.  
  111.                    <div class="FormLabelWrap" style="margin:2px 0px 20px 0px; height:27px;">
  112.                        <span id="GuestAuthenticationFormTitle" class="AuthenticationFormTitle">
  113.                            Guest
  114.                        </span>
  115.                        <span id="LoginAuthenticationFormTitle" class="AuthenticationFormTitle">
  116.                            Log in
  117.                        </span>
  118.                        <span id="RegistrationAuthenticationFormTitle" class="AuthenticationFormTitle">
  119.                            Sign up
  120.                        </span>
  121.  
  122.                        <span id="SwitchToRegistrationLabel" class="SwitchFormsLabel">Sign up</span>
  123.                        <span id="SwitchToLoginLabel" class="SwitchFormsLabel">Log in</span>
  124.                        <span id="SwitchToGuestLabel" class="SwitchFormsLabel">Guest</span>
  125.                    </div>
  126.  
  127.                    <div class="FormLabelWrap">
  128.                        <span class="FormLabelPrimary">Username:</span>
  129.  
  130.                        <input type="text" id="UsernameInput" class="FormInput"/>
  131.                    </div>
  132.  
  133.                    <div id="FormWrapPassword" class="FormLabelWrap">
  134.                        <span class="FormLabelPrimary">Password:</span>
  135.                        <input type="password" id="PasswordInput" class="FormInput"/>
  136.                    </div>
  137.  
  138.                    <div id="FormWrapPassword2" class="FormLabelWrap">
  139.                        <span class="FormLabelPrimary">Password: (enter again)</span>
  140.                        <input type="password" id="PasswordInput2" class="FormInput"/>
  141.                    </div>
  142.  
  143.                    <div id="FormWrapRememberDetails" class="FormLabelWrap">
  144.                        <input id="RememberDetailsBox" type="checkbox">
  145.                        <span id="RememberDetailsLabel">Remember login details</span>
  146.                    </div>
  147.                    <div style="clear:both;"></div>
  148.  
  149.                    <button id="GuestFormSubmit" class="FormSubmit">Chat as guest</button>
  150.                    <button id="LoginFormSubmit" class="FormSubmit">Log in</button>
  151.                    <button id="RegistrationFormSubmit" class="FormSubmit">Sign up</button>
  152.  
  153.                    <div id="FormSubmitHintArea"></div>
  154.                </div>
  155.            </div>
  156.        </div>
  157.    </body>
  158. </html>
  159.  
  160. """
  161.  
  162.  
  163. def application(environ, start_response):
  164.     if environ.get('PATH_INFO') == '/':
  165.         status = '200 OK'
  166.         content = HELLO_WORLD
  167.     else:
  168.         status = '404 NOT FOUND'
  169.         content = 'Page not found.'
  170.     response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))]
  171.     start_response(status, response_headers)
  172.     yield content.encode('utf8')
  173.  
  174.  
  175. # Below are templates for Django and Flask.  You should update the file
  176. # appropriately for the web framework you're using, and then
  177. # click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site
  178. # live.
  179.  
  180. # +++++++++++ VIRTUALENV +++++++++++
  181. # If you want to use a virtualenv, set its path on the web app setup tab.
  182. # Then come back here and import your application object as per the
  183. # instructions below
  184.  
  185.  
  186. # +++++++++++ CUSTOM WSGI +++++++++++
  187. # If you have a WSGI file that you want to serve using PythonAnywhere, perhaps
  188. # in your home directory under version control, then use something like this:
  189. #
  190. #import sys
  191. #
  192. #path = '/home/crosstalk/path/to/my/app
  193. #if path not in sys.path:
  194. #    sys.path.append(path)
  195. #
  196. #from my_wsgi_file import application
  197.  
  198.  
  199. # +++++++++++ DJANGO +++++++++++
  200. # To use your own django app use code like this:
  201. #import os
  202. #import sys
  203. #
  204. ## assuming your django settings file is at '/home/crosstalk/mysite/mysite/settings.py'
  205. ## and your manage.py is is at '/home/crosstalk/mysite/manage.py'
  206. #path = '/home/crosstalk/mysite'
  207. #if path not in sys.path:
  208. #    sys.path.append(path)
  209. #
  210. #os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
  211. #
  212. ## then, for django >=1.5:
  213. #from django.core.wsgi import get_wsgi_application
  214. #application = get_wsgi_application()
  215. ## or, for older django <=1.4
  216. #import django.core.handlers.wsgi
  217. #application = django.core.handlers.wsgi.WSGIHandler()
  218.  
  219.  
  220.  
  221. # +++++++++++ FLASK +++++++++++
  222. # Flask works like any other WSGI-compatible framework, we just need
  223. # to import the application.  Often Flask apps are called "app" so we
  224. # may need to rename it during the import:
  225. #
  226. #
  227. #import sys
  228. #
  229. ## The "/home/crosstalk" below specifies your home
  230. ## directory -- the rest should be the directory you uploaded your Flask
  231. ## code to underneath the home directory.  So if you just ran
  232. ## "git clone git@github.com/myusername/myproject.git"
  233. ## ...or uploaded files to the directory "myproject", then you should
  234. ## specify "/home/crosstalk/myproject"
  235. #path = '/home/crosstalk/path/to/flask_app_directory'
  236. #if path not in sys.path:
  237. #    sys.path.append(path)
  238. #
  239. ## After you uncomment the line below, the yellow triangle on the left
  240. ## side in our in-browser editor shows a warning saying:
  241. ##     'application' imported but unused.
  242. ## You can ignore this error. The line is necessary, and the variable
  243. ## is used externally.
  244. #from main_flask_app_file import app as application
  245. #
  246. # NB -- many Flask guides suggest you use a file called run.py; that's
  247. # not necessary on PythonAnywhere.  And you should make sure your code
  248. # does *not* invoke the flask development server with app.run(), as it
  249. # will prevent your wsgi file from working.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement