hosting Django on Apache - python

I'm following a tutorial trying to host Django on apache server, now as I finally installed mod_wsgi using cmd, I try to use the command:
mod_wsgi-express module-config
now i get another bugging error - which is:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
(Adwy) C:\Users\Adwy>mod_wsgi-express module-config
Traceback (most recent call last):
File "C:\Users\Adwy\AppData\Local\Programs\Python\Python35\Scripts\mod_wsgi-express-script.py", line 11, in <module>
load_entry_point('mod-wsgi==4.5.20', 'console_scripts', 'mod_wsgi-express')()
File "c:\users\adwy\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\users\adwy\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\__init__.py", line 2859, in load_entry_point
return ep.load()
File "c:\users\adwy\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\__init__.py", line 2450, in load
return self.resolve()
File "c:\users\adwy\appdata\local\programs\python\python35\lib\site-packages\pkg_resources\__init__.py", line 2456, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\users\adwy\appdata\local\programs\python\python35\lib\site-packages\mod_wsgi\server\__init__.py", line 24, in <module>
from . import apxs_config
File "c:\users\adwy\appdata\local\programs\python\python35\lib\site-packages\mod_wsgi\server\apxs_config.py", line 27
LIBEXECDIR = 'C:\xampp\apache\/lib'
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-4: truncated \xXX escape
I'm looking for help!
thanks,

Looks like you might need to set the MOD_WSGI_APACHE_ROOTDIR environment variable with forward slashes.
example:
"C:/foo/bar/apache"
To apply this changes you need to reinstall mod_wsgi:
pip uninstall mod_wsgi
pip install mod_wsgi

Looks like you might need to set the MOD_WSGI_APACHE_ROOTDIR environment variable with forward slashes. example: "C:/foo/bar/apache"
Take a look at this issue, which looks similar:
https://github.com/GrahamDumpleton/mod_wsgi/issues/345

Related

Fabric ImportError: cannot import name 'isMappingType' with Python 2.7

I am trying to get Fab up and running locally. Why is Fab installing to /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5? The system Python version is 2.7.10, confirmed below:
Toms-MBP:~ tom$ which python
/usr/local/bin/python
Toms-MBP:~ tom$ python --version
Python 2.7.10
Toms-MBP:~ tom$ head -1 `which fab`
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
Toms-MBP:~ tom$ fab
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/fab", line 9, in <module>
load_entry_point('Fabric==1.11.1', 'console_scripts', 'fab')()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/fabric/main.py", line 13, in <module>
from operator import isMappingType
ImportError: cannot import name 'isMappingType'
you need this:
pip install fabric3
Its look like you aren't using a virtualenv configured previously, so I think that the system just uses the normal path to python which means to /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 .
This error is usual when we try use Fabric with python3.x because Fabric has not been update to this version of python which is really sad.

Pip spitting UnicodeDecode error

I'm not 100% positive as to what is the correct place to post this question since it's 50% programming since it's a python bug and 50% system management, since it's a bug on a package. I went on to post here, If I'm incorrect please direct me to the right place.
I'm currently running Arch Linux 64 bit and earlier today I updated a couple of packages including the (critical I believe) python-setuptools. Before this pip worked perfectly, no issues whatsoever, now however just from running the bare command I get the following:
espaco#Arch ~> pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3143, in <module>
#_call_aside
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3129, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3156, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 649, in _build_master
ws = cls()
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 642, in __init__
self.add_entry(entry)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 698, in add_entry
for dist in find_distributions(entry, True):
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2136, in find_on_path
path_item, entry, metadata, precedence=DEVELOP_DIST
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2518, in from_location
version = cls._version_from_metadata(dist_path) or version
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2841, in _version_from_metadata
return _version_from_file(strm)
File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2483, in _version_from_file
line = next(iter(version_lines), '')
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 116: ordinal not in range(128)
Is this something I did wrong or does pip have a bug? How would I be able to fix this?
What I have tried:
Reinstalling pip
Reinstalling python-setuptools
The almighty reboot
Ask my mom to kiss bash in the forehead
Search the Arch package list for a bug report
Google the problem
$ ll /var/cache/pacman/pkg/python-setuptools-*
then select desired version, and
$ sudo pacman -U /var/cache/pacman/pkg/python-setuptools-1:18.7-1-any.pkg.tar.xz
where 1:18.7-1 is your previous version of the package
if it will not help:
$ cat /var/log/pacman.log | grep 2015-11-30 | grep upgraded
and then for each package install it's previous version by doing part 1
you can write a script for that or find existing.
also try to search arch community forums

Error after installing pip with easy install (on mac)

I tried to download pip with easy install but after installation whenever I type pip into the mac terminal it gives me this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module>
load_entry_point('pip==7.0.3', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1906, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-7.0.3-py2.5.egg/pip/__init__.py", line 211
except PipError as exc:
^
SyntaxError: invalid syntax
and when I try to do pip install pyopengl, it gives me the same error. What do I do to fix this?
Modern pip works with Python 2.6 and higher. It seems you got Python 2.5, so you either need to upgrade Python or use older version of pip.
According to the documentation Python 2.5 was supported through v1.3.1 of pip.

SyntaxError: invalid syntax wheninstalling pip on OSX

I have installed pip according to instructions on pip website. Downloaded get-pip.py and insatlled it with python get-pip.py. Got a confirmation saying installation is successful. Apparently the moment i type pip i get following error:
[fh-mi-sdb99-ma:~/Downloads] sdb99% pip
/Library/Python/2.5/site-packages/pip-6.1.1-py2.5.egg/pip/__init__.py:211: Warning: 'as' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module>
load_entry_point('pip==6.1.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2174, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1907, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-6.1.1-py2.5.egg/pip/__init__.py", line 211
except PipError as exc:
^
SyntaxError: invalid syntax
i am not sure why is this happening..
Any suggestion that would help me to get pip installed correctly on my mac?
Thanks!
EDIT:
[fh-mi-sdb99-ma:~/Downloads] sdb99% python --version
Python 2.7.9
[fh-mi-sdb99-ma:~/Downloads] sdb99% pip --version
/Library/Python/2.5/site-packages/pip-6.1.1-py2.5.egg/pip/__init__.py:211: Warning: 'as' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module>
load_entry_point('pip==6.1.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2174, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1907, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-6.1.1-py2.5.egg/pip/__init__.py", line 211
except PipError as exc:
^
SyntaxError: invalid syntax
Second EDIT:
I have installed python 3.5 pkg but still when i type python on terminal, python 2.7 is initiated..
Your stack trace indicates that you are actually running python2.5
Verification
To verify your python version run python --version.
I would also verify your pip version by running pip --version.
Using the correct python
If you already installed python2.7, you can often specify it specifically, for example: python2.7 my_module.py. Try typing python in your terminal and tap TAB twice. This will list all the python* programs you have in your path. If python2.7 is not listed, you will need to install it.
Using the correct pip
Similar to the above about using the correct python, you should ensure you are using the correct pip.
Try typing pip into your terminal and tap TAB twice. This will list any extra pip versions you have. It is often easier to specify pip2.7.
Download and install Python3.4
If you haven't made a firm decision between python2 and python3, a nice feature of python3 is that python3.4 is bundled with pip, so you don't have to do anything to use it.
Update
Python 2 is end-of-life. Python 3.4+ comes with pip
Original Answer
You are using Python 2.5, outdated version:
/Library/Python/2.5/
Please install at least Python 2.7 first:
https://www.python.org/downloads/

Issue creating project with mezzanine - shared hosting

I'm trying to use Mezzanine cms in a shared hosting at 1and1. I installed a recent python version 3.3.2.
setup works well but when i try to create a project I got the following error message:
~/Mezzanine-1.4.16 > mezzanine-project blog
Traceback (most recent call last):
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/bin/mezzanine-project", line 9, in
load_entry_point('Mezzanine==1.4.16', 'console_scripts', 'mezzanine-project')()
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 345, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2382, in load_entry_point
return ep.load()
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/Mezzanine-1.4.16-py3.3.egg/mezzanine/bin/mezzanine_project.py", line 9, in
from mezzanine.utils.importing import path_for_import
File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/Mezzanine-1.4.16-py3.3.egg/mezzanine/utils/importing.py", line 23
except (ValueError, ImportError, AttributeError), e:
^
SyntaxError: invalid syntax
Any thoughts on how to fix this ? thank you.
Current version of Mezzanine (1.4.16) doesn’t support Python 3. You have to use Python 2.6 / 2.7 (Source: dependencies section in official docs).
Now supporting with Mezzanine 3.x

Categories

Resources