[moin-user] Fwd: Re: MoinMoin2 on pythonanywhere

Roger Haase crosseyedpenguin at yahoo.com
Tue Feb 4 09:03:02 EST 2020


 
Did you upload the wsgi.py file?
On the bottom of the page, click the yellow button labeled "Upload a file".On the file dialog box, navigate to your local copy of the../moin/contrib/pythonanywhere/ directory and select the wsgi.py file,click the "Open" button. When the upload is complete you should see thewsgi.py file above the yellow "Upload a file" button.
Near the top right of the web page, click the "Web" button. Click the green"Reload MOINMOIN2.pythonanywhere.com" button.
When the reload is complete, click the link to MOINMOIN2.pythonanywhere.comthat is located just above the green button.
    On Tuesday, February 4, 2020, 02:22:26 AM MST, Renato Pontefice <renato.pontefice at gmail.com> wrote:  
 
 nothing...2020-02-04 09:12:32,178: ***************************************************
2020-02-04 09:12:32,923: Error running WSGI application
2020-02-04 09:12:32,923: ModuleNotFoundError: No module named 'wsgi'
2020-02-04 09:12:32,924:   File "/var/www/rp20_pythonanywhere_com_wsgi.py", line 4, in <module>
2020-02-04 09:12:32,924:     from wsgi import application  # noqa
2020-02-04 09:12:32,924: ***************************************************
2020-02-04 09:12:32,924: If you're seeing an import error and don't know why,
2020-02-04 09:12:32,924: we have a dedicated help page to help you debug: 
2020-02-04 09:12:32,924: https://help.pythonanywhere.com/pages/DebuggingImportError/
2020-02-04 09:12:32,924: ***************************************************

I've created a brand new /var/www/rp20_pythonanywhere_com_wsgi.py that is just 4 lines, this:

# Copy the contents of this file to the pythonanywhere
# WSGI configuration file:  /var/www/<account-name>_pythonanywhere_com_wsgi.py

from wsgi import application  # noqa
I've reloaded it, but it does not work

Renato


Il giorno lun 3 feb 2020 alle ore 20:34 Roger Haase <crosseyedpenguin at yahoo.com> ha scritto:

 On the "Manual Configuration" popup, click "Next" near lower right. Thatshould bring you here:
    https://www.pythonanywhere.com/user/rp20/webapps/#tab_id_rp20_pythonanywhere_com Scroll down to about the middle of the page to the section labeled "Code"and edit the section so it looks similar to this (MOINMOIN2 replaced by rp20)
    Code:
    What your site is running.    Source code:                  /home/rp20/moin/src/moin
    Working directory:            /home/rp20/moin
    WSGI configuration file:      /var/www/rp20_pythonanywhere_com_wsgi.py
    Python version:               3.7

    Virtualenv:
    -- snip 3 lines --
    /home/rp20/moin-venv-python3.7/
----------
This file: /var/www/rp20_pythonanywhere_com_wsgi.py should contain only a few lines"
"""# Copy the contents of this file to the pythonanywhere# WSGI configuration file:  /var/www/<account-name>_pythonanywhere_com_wsgi.py
from wsgi import application  # noqa"""
You should have replaced it per the instructions:"Next, click the WSGI configuration file link:"/var/www/MOINMOIN2_pythonanywhere_com_wsgi.cpy"
You will see the file contents. Keep the browser window open. Switch to yourfavorite file editor that has the file named _pythonanywhere_com_wsgi.pyloaded. Copy and paste the contents of that file into the browser windowreplacing everything. Click the Save button near the upper right."    On Monday, February 3, 2020, 09:57:19 AM MST, Renato Pontefice <renato.pontefice at gmail.com> wrote:  
 
  

 
 
 
 -------- Messaggio Inoltrato -------- 
| Oggetto:  | Re: [moin-user] MoinMoin2 on pythonanywhere |
| Data:  | Mon, 3 Feb 2020 17:55:51 +0100 |
| Mittente:  | Renato Pontefice <renato.pontefice at gmail.com> |
| A:  | Roger Haase <crosseyedpenguin at yahoo.com> |

 
 
 
Hi,
 
my virtualenv name is:/home/MOINMOIN2/moin-venv-python3/ python version is 3.7
 
this is my rp20_pythonanywhere_com_wsgi.py:
 
 from MoinMoin.app import create_app
application = create_app('/home/rp20/moin/wikiconfig.py')

# This file contains the WSGI configuration required to serve up your
# web application at http://rp20.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#

# +++++++++++ GENERAL DEBUGGING TIPS +++++++++++
# getting imports and sys.path right can be fiddly!
# We've tried to collect some general tips here:
# https://help.pythonanywhere.com/pages/DebuggingImportError


# +++++++++++ HELLO WORLD +++++++++++
# A little pure-wsgi hello world we've cooked up, just
# to prove everything works.  You should delete this
# code to get your own working.


HELLO_WORLD = """<html>
<head>
    <title>PythonAnywhere hosted web application</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>
    This is the default welcome page for a
    <a href="https://www.pythonanywhere.com/">PythonAnywhere</a>
    hosted web application.
</p>
<p>
    Find out more about how to configure your own web application
    by visiting the <a href="https://www.pythonanywhere.com/web_app_setup/">web app setup</a> page
</p>
</body>
</html>"""


def application(environ, start_response):
    if environ.get('PATH_INFO') == '/':
        status = '200 OK'
        content = HELLO_WORLD
    else:
        status = '404 NOT FOUND'
        content = 'Page not found.'
    response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))]
    start_response(status, response_headers)
    yield content.encode('utf8')


# Below are templates for Django and Flask.  You should update the file
# appropriately for the web framework you're using, and then
# click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site
# live.

# +++++++++++ VIRTUALENV +++++++++++
# If you want to use a virtualenv, set its path on the web app setup tab.
# Then come back here and import your application object as per the
# instructions below


# +++++++++++ CUSTOM WSGI +++++++++++
# If you have a WSGI file that you want to serve using PythonAnywhere, perhaps
# in your home directory under version control, then use something like this:
#
#import sys
#
#path = '/home/rp20/path/to/my/app
#if path not in sys.path:
#    sys.path.append(path)
#
#from my_wsgi_file import application  # noqa


# +++++++++++ DJANGO +++++++++++
# To use your own django app use code like this:
#import os
#import sys
#
## assuming your django settings file is at '/home/rp20/mysite/mysite/settings.py'
## and your manage.py is is at '/home/rp20/mysite/manage.py'
#path = '/home/rp20/mysite'
#if path not in sys.path:
#    sys.path.append(path)
#
#os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
#
## then:
#from django.core.wsgi import get_wsgi_application
#application = get_wsgi_application()



# +++++++++++ FLASK +++++++++++
# Flask works like any other WSGI-compatible framework, we just need
# to import the application.  Often Flask apps are called "app" so we
# may need to rename it during the import:
#
#
#import sys
#
## The "/home/rp20" below specifies your home
## directory -- the rest should be the directory you uploaded your Flask
## code to underneath the home directory.  So if you just ran
## "git clone git at github.com/myusername/myproject.git"
## ...or uploaded files to the directory "myproject", then you should
## specify "/home/rp20/myproject"
#path = '/home/rp20/path/to/flask_app_directory'
#if path not in sys.path:
#    sys.path.append(path)
#
#from main_flask_app_file import app as application  # noqa
#
# NB -- many Flask guides suggest you use a file called run.py; that's
# not necessary on PythonAnywhere.  And you should make sure your code
# does *not* invoke the flask development server with app.run(), as it
# will prevent your wsgi file from working.
 
 Il 03/02/20 15:49, Roger Haase ha scritto:
  
 
 A guess is you failed to follow the instructions. A second guess is the instructions are wrong. A third guess is you loaded moin 1.9; instructions are only for moinmoin2. 
  
  Go to (replacing MOINMOIN2 with your account name): 
      https://www.pythonanywhere.com/user/MOINMOIN2/webapps/#tab_id_MOINMOIN2_pythonanywhere_com 
  Scroll down to about the middle of the page to the section labeled "Code" and copy and paste the contents of the code section to your reply email. 
  ---------------- 
      Code: 
      What your site is running.     Source code:                  /home/MOINMOIN2/moin/src/moin 
      Working directory:            /home/MOINMOIN2/moin 
      WSGI configuration file:      /var/www/MOINMOIN2_pythonanywhere_com_wsgi.py 
      Python version:               3.7 
  
      Virtualenv: 
      -- snip 3 lines -- 
      /home/MOINMOIN2/moin-venv-python3.7/  
  ------------------- 
  Also copy and paste the contents of the  /var/www/MOINMOIN2_pythonanywhere_com_wsgi.py file. 
  
       On Monday, February 3, 2020, 05:08:17 AM MST, Renato Pontefice <renato.pontefice at gmail.com> wrote:  
  
     Hi, it still dont work and on log errorm I found:this: 
   > ***************************************************
 2020-02-03 11:55:44,235: Error running WSGI application
 2020-02-03 11:55:44,271: ModuleNotFoundError: No module named 'MoinMoin'
 2020-02-03 11:55:44,271:   File "/var/www/rp20_pythonanywhere_com_wsgi.py", line 1, in <module>
 2020-02-03 11:55:44,272:     from MoinMoin.app import create_app
 2020-02-03 11:55:44,272: *************************************************** 
  who has to put MoinMoin module on that directory? Why it is not there? 
  TIA Renato
    _______________________________________________
 moin-user mailing list
 moin-user at python.org
 https://mail.python.org/mailman/listinfo/moin-user
    _______________________________________________
moin-user mailing list
moin-user at python.org
https://mail.python.org/mailman/listinfo/moin-user
  
_______________________________________________
moin-user mailing list
moin-user at python.org
https://mail.python.org/mailman/listinfo/moin-user
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/moin-user/attachments/20200204/ed98d268/attachment-0001.html>


More information about the moin-user mailing list