Re: wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Coulson Kgathi
ok thanks

c.t.kgathi
On 28 Jun 2016 16:57, "Avraham Serour"  wrote:

> most are for linux, but I believe you can adapt
>
>
> https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
> https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/uwsgi/
> http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
> https://www.nginx.com/resources/admin-guide/gateway-uwsgi-django/
>
> https://www.linode.com/docs/websites/nginx/deploy-django-applications-using-uwsgi-and-nginx-on-ubuntu-14-04
>
>
>
>
> On Tue, Jun 28, 2016 at 5:52 PM, Coulson Kgathi  wrote:
>
>> deploying my mac as a server
>>
>> could you point me to the proper documentation to deploy using nginx+uwsgi
>> so i can try it
>>
>>
>> On Tue, Jun 28, 2016 at 4:49 PM, Avraham Serour 
>> wrote:
>>
>>> it seems it doesn't have cffi installed
>>>
>>> but why do you want to do this? are you using the mac as server of are
>>> you setting up your development environment?
>>>
>>> for development you may just use manage.py runserver, you don't need to
>>> setup apache
>>>
>>> for the server I recommend using nginx+uwsgi, the killer feature for
>>> nginx over apache is the simpler config file
>>>
>>>
>>> On Tue, Jun 28, 2016 at 5:43 PM, Coulson Kgathi 
>>> wrote:
>>>
>>>> I am getting an error trying to setup my django project on apache2 mac
>>>> os x, django 1.9, python 3
>>>>
>>>> my wsgi.py looks like this
>>>>
>>>> import os
>>>>
>>>> import sys
>>>>
>>>>
>>>> VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'
>>>>
>>>> SOURCE_ROOT_PATH = '/Users/ckgathi/source'
>>>>
>>>> LOCAL_PROJECT_RELPATH = 'bcpp-interview/'
>>>>
>>>>
>>>> # Activate the virtual env
>>>>
>>>> activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')
>>>>
>>>> # execfile(activate_env, dict(__file__=activate_env))
>>>>
>>>> file_p = '/Users/ckgathi/.virtualenvs/bcpp
>>>> -interview/bin/activate_this.py'
>>>>
>>>> exec(open(activate_env).read(), dict(__file__=activate_env))
>>>>
>>>> # Add the site-packages of the chosen virtualenv to work with
>>>>
>>>> # update path
>>>>
>>>> sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
>>>> /python3.5/site-packages'))
>>>>
>>>> sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH,
>>>> LOCAL_PROJECT_RELPATH))
>>>>
>>>>
>>>> os.environ.setdefault("DJANGO_SETTINGS_MODULE",
>>>> 'bcpp_interview.settings')
>>>>
>>>>
>>>> from django.core.wsgi import get_wsgi_application
>>>>
>>>> application = get_wsgi_application()
>>>>
>>>>
>>>> and its giving me error
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> [Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote
>>>> 127.0.0.1:0] mod = import_module(mod_path)
>>>>
>>>> [Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote
>>>> 127.0.0.1:0]   File
>>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
>>>> line 37, in import_module
>>>>
>>>> [Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote
>>>> 127.0.0.1:0] __import__(name)
>>>>
>>>> [Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote
>>>> 127.0.0.1:0]   File
>>>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
>>>> line 2, in 
>>>>
>>>> [Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote
>>>> 127.0.0.1:0] import sounddevice as sd
>>>>
>>>> [Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote
>>>> 127.0.0.1:0]   File
>>>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
>>>> line 34, in 
>>>>
>>>> [Tue Jun 28 16:41:40.781765 2016] [ws

Re: Deploying Django via wsgi

2016-06-28 Thread Coulson Kgathi
how did you do that? please assist

On Saturday, 19 March 2016 00:22:18 UTC+2, parall...@gmail.com wrote:
>
> Thank you all for your replies. It turned out to be something simple. 
> Since Django was installed in a virtualenv I needed to include the path to 
> the Django libs in the wsgi paths. Done and site up.
>
> Again thanks!
>
>
>
> On Tuesday, March 15, 2016 at 5:00:10 AM UTC-7, parall...@gmail.com wrote:
>>
>> Quite new, and trying to deploy first Django site. I keep getting 503 
>> errors. Here are the particulars, any hints as to what I'm doing wrong 
>> would be much appreciated! All directories and files are group owned and 
>> writable by www-data. Ubuntu server, and Apache2.4 server where I have root 
>> access. The tutorial where I got the howto is located here:
>>
>> https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04
>>
>> Thank you!
>>
>> *File structure/location:*
>>
>> /home/user/kb_venv/project_name/
>> __init__.py
>> settings.py
>> urls.py
>> wsgi.py
>> manage.py
>> app_name
>>
>> /home/user/kb_venv/project_name/project_name/
>> apache/
>> __init__.py
>> override.py
>> wsgi.py
>>
>>
>> *override.py file contents:*
>> from project_name.settings import
>> DEBUG = True
>> #ALLOWED_HOSTS = ['104.131.154.99'] (no domain name, I'm using IP to 
>> access the site)
>>
>> *wsgi.py file contents:*
>> #wsgi.py
>> import os, sys
>> # Calculate the path based on the location of the WSGI script.
>> apache_configuration= os.path.dirname(__file__)
>> project = os.path.dirname(apache_configuration)
>> workspace = os.path.dirname(project)
>> sys.path.append(workspace)
>> sys.path.append(project)
>>
>> # Add the path to 3rd party django application and to django itself.
>> sys.path.append('/home/smlake/kb_venv')
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'project_name.apache.override'
>> from django.core.wsgi import get_wsgi_application
>> application = get_wsgi_application()
>>
>> *Apache2.4 000-default file:*
>> 
>>
>> WSGIScriptAlias / /home/smlake/kb_venv/project_name/apache/wsgi.py
>> 
>>   Require all granted
>> 
>> ServerAdmin parall...@gmail.com 
>> DocumentRoot /home/smlake/kb_venv/project_name/project_name
>>
>> ErrorLog ${APACHE_LOG_DIR}/error.log
>> CustomLog ${APACHE_LOG_DIR}/access.log combined
>>
>> 
>>
>>
>> *Apache error log entry:*
>> [Mon Mar 14 23:58:48.413099 2016] [authz_core:error] [pid 8034:tid 
>> 140480713053952] [client 54.188.195.80:57782] AH01630: client denied by 
>> server configuration: /home/user/kb_venv/project_name/
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/62362ac3-2fad-416a-ba71-d895141fc4cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Coulson Kgathi
deploying my mac as a server

could you point me to the proper documentation to deploy using nginx+uwsgi
so i can try it


On Tue, Jun 28, 2016 at 4:49 PM, Avraham Serour  wrote:

> it seems it doesn't have cffi installed
>
> but why do you want to do this? are you using the mac as server of are you
> setting up your development environment?
>
> for development you may just use manage.py runserver, you don't need to
> setup apache
>
> for the server I recommend using nginx+uwsgi, the killer feature for nginx
> over apache is the simpler config file
>
>
> On Tue, Jun 28, 2016 at 5:43 PM, Coulson Kgathi  wrote:
>
>> I am getting an error trying to setup my django project on apache2 mac os
>> x, django 1.9, python 3
>>
>> my wsgi.py looks like this
>>
>> import os
>>
>> import sys
>>
>>
>> VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'
>>
>> SOURCE_ROOT_PATH = '/Users/ckgathi/source'
>>
>> LOCAL_PROJECT_RELPATH = 'bcpp-interview/'
>>
>>
>> # Activate the virtual env
>>
>> activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')
>>
>> # execfile(activate_env, dict(__file__=activate_env))
>>
>> file_p = '/Users/ckgathi/.virtualenvs/bcpp
>> -interview/bin/activate_this.py'
>>
>> exec(open(activate_env).read(), dict(__file__=activate_env))
>>
>> # Add the site-packages of the chosen virtualenv to work with
>>
>> # update path
>>
>> sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
>> /python3.5/site-packages'))
>>
>> sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH, LOCAL_PROJECT_RELPATH))
>>
>>
>> os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'bcpp_interview.settings'
>> )
>>
>>
>> from django.core.wsgi import get_wsgi_application
>>
>> application = get_wsgi_application()
>>
>>
>> and its giving me error
>>
>>
>>
>>
>>
>>
>> [Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] mod = import_module(mod_path)
>>
>> [Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
>> line 37, in import_module
>>
>> [Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] __import__(name)
>>
>> [Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
>> line 2, in 
>>
>> [Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] import sounddevice as sd
>>
>> [Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
>> line 34, in 
>>
>> [Tue Jun 28 16:41:40.781765 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] _ffi = _FFI()
>>
>> [Tue Jun 28 16:41:40.781779 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0]   File
>> "/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/cffi/api.py",
>> line 56, in __init__
>>
>> [Tue Jun 28 16:41:40.781996 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] import _cffi_backend as backend
>>
>> [Tue Jun 28 16:41:40.782018 2016] [wsgi:error] [pid 3854] [remote
>> 127.0.0.1:0] ImportError: No module named _cffi_backend
>>
>> [Tue Jun 28 16:41:40.898298 2016] [wsgi:info] [pid 3853] mod_wsgi
>> (pid=3853): Create interpreter 'interview|'.
>>
>> [Tue Jun 28 16:41:40.900250 2016] [wsgi:info] [pid 3853] mod_wsgi
>> (pid=3853): Adding '/Users/ckgathi/bcpp-interview' to path.
>>
>> [Tue Jun 28 16:41:40.900503 2016] [wsgi:info] [pid 3853] mod_wsgi
>> (pid=3853): Adding
>> '/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages' to
>> path.
>>
>> [Tue Jun 28 16:41:40.904407 2016] [wsgi:info] [pid 3853] [remote
>> 127.0.0.1:0] mod_wsgi (pid=3853, process='interview',
>> application='interview|'): Loading WSGI script
>> '/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.
>>
>> [Tue Jun 28 16:41:42.319143 2016] [wsgi:error] [pid 3853] [remote
>> 127.

wsgi setup + django 1.9 + python 3.5.1 on mac os x

2016-06-28 Thread Coulson Kgathi
I am getting an error trying to setup my django project on apache2 mac os 
x, django 1.9, python 3

my wsgi.py looks like this

import os

import sys


VIRTUALENV_PATH = '/Users/ckgathi/.virtualenvs/bcpp-interview/'

SOURCE_ROOT_PATH = '/Users/ckgathi/source'

LOCAL_PROJECT_RELPATH = 'bcpp-interview/'


# Activate the virtual env

activate_env=os.path.join(VIRTUALENV_PATH,'bin/activate_this.py')

# execfile(activate_env, dict(__file__=activate_env))

file_p = '/Users/ckgathi/.virtualenvs/bcpp-interview/bin/activate_this.py'

exec(open(activate_env).read(), dict(__file__=activate_env))

# Add the site-packages of the chosen virtualenv to work with

# update path

sys.path.insert(0, os.path.join(VIRTUALENV_PATH, 'local/lib
/python3.5/site-packages'))

sys.path.insert(0, os.path.join(SOURCE_ROOT_PATH, LOCAL_PROJECT_RELPATH))


os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'bcpp_interview.settings')


from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()


and its giving me error






[Tue Jun 28 16:41:40.781127 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] mod = import_module(mod_path)

[Tue Jun 28 16:41:40.781143 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
 
line 37, in import_module

[Tue Jun 28 16:41:40.781205 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] __import__(name)

[Tue Jun 28 16:41:40.781218 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/edc_audio_recording/apps.py",
 
line 2, in 

[Tue Jun 28 16:41:40.781265 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] import sounddevice as sd

[Tue Jun 28 16:41:40.781278 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/sounddevice.py",
 
line 34, in 

[Tue Jun 28 16:41:40.781765 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] _ffi = _FFI()

[Tue Jun 28 16:41:40.781779 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/cffi/api.py",
 
line 56, in __init__

[Tue Jun 28 16:41:40.781996 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] import _cffi_backend as backend

[Tue Jun 28 16:41:40.782018 2016] [wsgi:error] [pid 3854] [remote 
127.0.0.1:0] ImportError: No module named _cffi_backend

[Tue Jun 28 16:41:40.898298 2016] [wsgi:info] [pid 3853] mod_wsgi 
(pid=3853): Create interpreter 'interview|'.

[Tue Jun 28 16:41:40.900250 2016] [wsgi:info] [pid 3853] mod_wsgi 
(pid=3853): Adding '/Users/ckgathi/bcpp-interview' to path.

[Tue Jun 28 16:41:40.900503 2016] [wsgi:info] [pid 3853] mod_wsgi 
(pid=3853): Adding 
'/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages' to 
path.

[Tue Jun 28 16:41:40.904407 2016] [wsgi:info] [pid 3853] [remote 
127.0.0.1:0] mod_wsgi (pid=3853, process='interview', 
application='interview|'): Loading WSGI script 
'/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.

[Tue Jun 28 16:41:42.319143 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] mod_wsgi (pid=3853): Target WSGI script 
'/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py' cannot be 
loaded as Python module.

[Tue Jun 28 16:41:42.319227 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] mod_wsgi (pid=3853): Exception occurred processing WSGI script 
'/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py'.

[Tue Jun 28 16:41:42.319258 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] Traceback (most recent call last):

[Tue Jun 28 16:41:42.319284 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/source/bcpp-interview/bcpp_interview/wsgi.py", line 21, in 


[Tue Jun 28 16:41:42.319363 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] application = get_wsgi_application()

[Tue Jun 28 16:41:42.319379 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/django/core/wsgi.py",
 
line 13, in get_wsgi_application

[Tue Jun 28 16:41:42.319432 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] django.setup()

[Tue Jun 28 16:41:42.319446 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/django/__init__.py",
 
line 18, in setup

[Tue Jun 28 16:41:42.319493 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] apps.populate(settings.INSTALLED_APPS)

[Tue Jun 28 16:41:42.319510 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0]   File 
"/Users/ckgathi/.virtualenvs/bcpp-interview/lib/python3.5/site-packages/django/apps/registry.py",
 
line 85, in populate

[Tue Jun 28 16:41:42.319644 2016] [wsgi:error] [pid 3853] [remote 
127.0.0.1:0] app_config = AppConfig.create(entry)

[Tue Jun 28 16:41:42.319661 2016] [ws