Mercurial http interface under Ubuntu Hardy. Doesn't work - python

I am trying to deploy mercurial under Ubuntu 8.04.
Mercurial packages were installed correctly, but when I've configured http interface I always get 500 error.
I enabled outputting debug info to error.log and got:
mod_wsgi (pid=21159): Exception occurred within WSGI script
'/home/hg/rep/hgwebdir.wsgi'.
Traceback (most recent call last):
File "/home/hg/rep/hgwebdir.wsgi", line 67, in <module>
wsgicgi.launch(application)
File "/var/lib/python-support/python2.5/mercurial/hgweb/wsgicgi.py", line 64, in launch
result = application(environ, start_response)
TypeError: 'hgwebdir' object is not callable
My desktop is with Ubuntu 10.04, and home server with ubuntu 9.10, and configuration is the same, and works like a charm.
I compiled python 2.6, and in hgwebdir.wsgi put path to this library -
import sys
sys.path.insert(0, "/path/to/python/lib")
But it doesn't work anyways.
What shall I do??
Thanks.

Which version of mercurial are you using? If you're still using the 1.0.x that ubuntu ships update to the PPAs from launchpad: https://launchpad.net/~mercurial-ppa/+archive/stable-snapshots
In 1.6 hgwebdir has been renamed to just 'hgweb' which will alter your config slightly.
Also what are you using the launch the wsgi stuff? Apache?

Related

Could not import Django, working last week

This was working last week,
when running python manage.py runserver 8080
I get this new error, a week after it was working fine.
Traceback (most recent call last):
File "manage.py", line 10, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 16, in main
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
Seems like it does not find the django module.
Where you usinga virtualenv? If True then you forgot to activate:
source venv/bin/activate
'venv' is the name of your virtual environment
Have you tried to reinstall django module?
python -m pip install Django
I could try to keep reinstalling Django every time this happens, but
I found a solution
I am very confused why python manage.py runserver 8080 was working last week but not working this week! Very frustrating.
I was facing similar issue. Pycharm was not showing and django options. To configure I did the following things:
go to edit configuration(run/debug menu)
In script path provide your manage.py location
in parameters provide 'runserver'
in python interpreter provide python location inside your virtual env
And now you can run and debug the django project using pycharm.
I can no longer execute Django from command line but only from PyCharm Run Manage.py Suddenly after a week of working with Django Flawlessly.
Edit: If you are having this problem, try restarting your computer, not PyCharm. Restarting the computer/machine was able to get me back into the following wonderful console runserver option.
python manage.py runserver 8080
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
March 03, 2020 - 12:22:19
Django version 3.0.3, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8080/
Quit the server with CTRL-BREAK.
Phew! Why this happened, I will never know.

importError using a virtualenv from cmd on Windows

trying to run a flask dev server on localhost:5000 using a virtualenv on Windows 7
In my command line in the project directory, i activated the virtualenv with the command "env\scripts\activate". It seemed to work, as my next line was preceded with an (env) tag. When I attempted to run the app file (bank_app), however, I got an import error.
Here's the console log
C:\Users\TJ\Documents\Python Projects\TestingPython> env\scripts\activate
(env) C:\Users\TJ\Documents\Python Projects\TestingPython> bank_app
Traceback (most recent call last):
File "C:\Users\TJ\Documents\Python Projects\TestingPython\bank_app.py", line 1, in <module>
from flask import Flask
ImportError: No module named flask
and here's a gist of the bank_app file (just in case it's relevant)
I'm used to running the code directly from PyCharm, which handles the virtualenv for me. it works fine running directly from PyCharm
This is probably related to how Windows maps extensions to executables.
You started the script with bank_app, which is really not the name of your script (your script has a .py extension I assume?). Windows must be doing a search in your directory, and then starting the script with the interpreter that is registered for the .py extension of the script, which is the globally installed interpreter, not the interpreter that is currently in the PATH.
I'm pretty sure if you run the command as python bank_app.py everything will work just fine.

MacVim vdebug python error

I am trying to use vdebug with MacVim and xdebug to debug code. I have MacVim and python installed via homebrew and xdebug is installed and working fine with MacGDBp.
When I listen in vdebug with the F5 key and reload a page (xdebug remote autostart is on) I get a python error in the vdebug quickfix window:
An error occured: <type 'exceptions.ImportError'>
Traceback (most recent call last):
File "/Users/mikedfunk/dotfiles/.vim/bundle/vdebug/plugin/python/start_vdebug.py", line 31, in run
self.runner.run()
File "/Users/mikedfunk/dotfiles/.vim/bundle/vdebug/plugin/python/vdebug/runner.py", line 160, in run
self.open()
File "/Users/mikedfunk/dotfiles/.vim/bundle/vdebug/plugin/python/vdebug/runner.py", line 74, in open
raise e
ImportError: No module named expat; use SimpleXMLTreeBuilder instead
I've googled this for a while and can't find a working solution. Any ideas?
This worked for me! Posted in case anyone else has the same problem:
https://stackoverflow.com/a/12697440/557215
It temporarily links the homebrew version of python to the mac system version before reinstalling MacVim. Now xdebug works!

error in running Google apps in python in windows OS

in google app engine
get error in runing the appicaition
in logs of googleappengine
2012-04-21 13:24:04 Running command: "['C:\Python32\pythonw.exe', 'C:\Program Files\Google\google_appengine\dev_appserver.py', '--admin_console_server=', '--port=8080', 'C:\udacity\googleapps\hello-udacity']"
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\dev_appserver.py", line 125, in
run_file(file, globals())
File "C:\Program Files\Google\google_appengine\dev_appserver.py", line 121, in run_file
execfile(script_path, globals_)
NameError: global name 'execfile' is not defined
2012-04-21 13:24:07 (Process exited with code 1)
You appear to be running Python 3.2 (your Python executable is on this path 'C:\Python32\pythonw.exe').
Google AppEngine requires Python 2.5 or 2.7 at this stage, see this article. You need to download Python 2.7, install it in a parallel directory, and make it the default executable.
You may find it helpful to read this answer on running more than one version of Python
Also, I had the same problem. This is because I have installed both Python 2.7 and Python 3.x (the latest version of the framework Django uses the latter). I installed Python 3.x later so this is the version that is used by default in my system. To use Python 2.7 you could do the following:
C:\Python27\python.exe dev_appserver.py path-to-your-app
Notice that here
C:\Python27\python.exe
is the path to the python 2.7 executable (in my case, but this could vary).
I did that and it worked.
More info and reading here.

Django running wrong version

Although running "python" from the shell runs Python v2.7, Django is loading files for python2.4, as shown in the error when I load a django site:
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch
log=debug)
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 461, in import_module
f, p, d = imp.find_module(parts[i], path)
ImportError: No module named django
I think Django is installed for version 2.7 and that's why the bottom says "No module named django"
This is my first django install (it's on a mediatemple DV server) so I wouldn't be surprised if I'm doing something stupid. Thanks!
mod_python is built for 2.4, but Django is installed for 2.7. Either build mod_python for 2.7, install Django under 2.4, or put a local copy of Django with your project so that the version of Python doesn't matter.

Categories

Resources