Re: [mezzanine-users] gunicorn.conf gives ImportError: No module named wsgi

2016-09-21 Thread dznektra
Thanks for your help!

I'm able to serve the static files for nektra.dev/admin with nginx now, so 
the admin works.

But --pythonpath doesn't work in the gunicorn.conf file:

exec nektra_coinfabrik_env/bin/gunicorn 
--pythonpath="/home/david/nektra_coinfabrik/nektra_coinfabrik," --workers 3 
--bind unix:/home/david/nektra_coinfabrik/nektra_coinfabrik.sock 
nektra_coinfabrik.wsgi:application
(I tried also --pythonpath /home/david/nektra_coinfabrik/nektra_coinfabrik)

I can start gunicorn with:

gunicorn -b 127.0.0.1:8000 -b 127.0.0.1:8001 
nektra_coinfabrik.wsgi:application

and

gunicorn --bind unix:/home/david/nektra_coinfabrik/nektra_coinfabrik.sock 
nektra_coinfabrik.wsgi:application

Then nektra.dev works but coinfabrik.dev doesn't display the theme of 
coinfabrik as it should, it displays the theme of nektra, too.

I tried with settings such as:

settings.py:

ALLOWED_HOSTS = [
'nektra.dev',  
'coinfabrik.dev.', 
"127.0.0.1:8000",
"127.0.0.1:8001"
# "localhost:8000"
"*",
]

HOST_THEMES = [
# ('nektra.dev', 'nektra'), 
# ('coinfabrik.dev', 'coinfabrik'),
('127.0.0.1:8000', 'nektra'), 
('127.0.0.1:8001', 'coinfabrik')
# ('localhost:8000', 'coinfabrik')
]

nginx:

server {
listen 80;
server_name coinfabrik.dev;

location / {
include proxy_params;
# proxy_pass 
http://unix:/home/david/nektra_coinfabrik/nektra_coinfabrik.sock;
# proxy_passhttp://localhost:8000; 
proxy_pass  http://127.0.0.1:8001; 
   }
}

What am I missing? 




On Friday, September 16, 2016 at 4:54:16 PM UTC-3, Ryne Everett wrote:
>
> If I pull out the contents out of nektra_coinfabrik/nektra_coinfabrik into 
>> /nektra_coinfabrik it somehow works but the admin is broken (cannot login, 
>> no styles).
>>
>
> That's because the path is wrong. Gunicorn is trying to import 
> `./nektra_coinfabrik/wsgi.py` from the current directory, but the correct 
> relative path is `./nektra_coinfabrik/nektra_coinfabrik/wsgi.py`. However, 
> simply changing the line to 
> `nektra_coinfabrik.nektra_coinfabrik.wsgi:application` probably wont work 
> because the outer nektra_coinfabrik directory is probably not a python 
> package and regardless your application probably depends on the package 
> directory being added to the python path. So I would try adding the to your 
> gunicorn flags 
> `--pythonpath="/home/david/nektra_coinfabrik/nektra_coinfabrik,"`.
>
> As for the admin being broken, you're probably not doing anything to serve 
> static assets. The django development server does this by default but 
> you'll have to come up with your own solution in production. The ideal way 
> is to serve them with your production server (e.g., nginx, apache, etc.) 
> but the python package dj-static is probably sufficient to start with.
>
> On Fri, Sep 16, 2016 at 3:21 PM,  wrote:
>
>> Hi,
>>
>> I'm trying to run mezzanine on gunicorn, but cannot configure the 
>> gunicorn.conf file correctly, I tried to change the path to .sock and to 
>> wsgi:application without success. 
>>
>> I get the error "ImportError: No module named wsgi". Gunicorn does't find 
>> the wsgi file.
>>
>> Development server works fine with nginx for static files.
>>
>> My file structure was created with the mezzanine-project command. It's a 
>> multi-tenancy project. 
>>
>> If I pull out the contents out of nektra_coinfabrik/nektra_coinfabrik 
>> into /nektra_coinfabrik it somehow works but the admin is broken (cannot 
>> login, no styles).
>>
>> Is there a way to configure the gunicorn.conf so I don't have to change 
>> my file structure?
>>
>> Find attached files.
>>
>> Thanks!
>>
>> David
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] gunicorn.conf gives ImportError: No module named wsgi

2016-09-16 Thread Ryne Everett
>
> If I pull out the contents out of nektra_coinfabrik/nektra_coinfabrik
> into /nektra_coinfabrik it somehow works but the admin is broken (cannot
> login, no styles).
>

That's because the path is wrong. Gunicorn is trying to import
`./nektra_coinfabrik/wsgi.py` from the current directory, but the correct
relative path is `./nektra_coinfabrik/nektra_coinfabrik/wsgi.py`. However,
simply changing the line to
`nektra_coinfabrik.nektra_coinfabrik.wsgi:application` probably wont work
because the outer nektra_coinfabrik directory is probably not a python
package and regardless your application probably depends on the package
directory being added to the python path. So I would try adding the to your
gunicorn flags
`--pythonpath="/home/david/nektra_coinfabrik/nektra_coinfabrik,"`.

As for the admin being broken, you're probably not doing anything to serve
static assets. The django development server does this by default but
you'll have to come up with your own solution in production. The ideal way
is to serve them with your production server (e.g., nginx, apache, etc.)
but the python package dj-static is probably sufficient to start with.

On Fri, Sep 16, 2016 at 3:21 PM,  wrote:

> Hi,
>
> I'm trying to run mezzanine on gunicorn, but cannot configure the
> gunicorn.conf file correctly, I tried to change the path to .sock and to
> wsgi:application without success.
>
> I get the error "ImportError: No module named wsgi". Gunicorn does't find
> the wsgi file.
>
> Development server works fine with nginx for static files.
>
> My file structure was created with the mezzanine-project command. It's a
> multi-tenancy project.
>
> If I pull out the contents out of nektra_coinfabrik/nektra_coinfabrik
> into /nektra_coinfabrik it somehow works but the admin is broken (cannot
> login, no styles).
>
> Is there a way to configure the gunicorn.conf so I don't have to change my
> file structure?
>
> Find attached files.
>
> Thanks!
>
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] gunicorn.conf gives ImportError: No module named wsgi

2016-09-16 Thread dznektra
Hi,

I'm trying to run mezzanine on gunicorn, but cannot configure the 
gunicorn.conf file correctly, I tried to change the path to .sock and to 
wsgi:application without success. 

I get the error "ImportError: No module named wsgi". Gunicorn does't find 
the wsgi file.

Development server works fine with nginx for static files.

My file structure was created with the mezzanine-project command. It's a 
multi-tenancy project. 

If I pull out the contents out of nektra_coinfabrik/nektra_coinfabrik into 
/nektra_coinfabrik it somehow works but the admin is broken (cannot login, 
no styles).

Is there a way to configure the gunicorn.conf so I don't have to change my 
file structure?

Find attached files.

Thanks!

David

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
description "Gunicorn application server handling nektra_coinfabrik"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
setuid david
setgid www-data
chdir /home/david/nektra_coinfabrik

exec nektra_coinfabrik_env/bin/gunicorn --workers 3 --bind 
unix:/home/david/nektra_coinfabrik/nektra_coinfabrik.sock 
nektra_coinfabrik.wsgi:application





nektra_coinfabrik
Description: Binary data

from __future__ import absolute_import, unicode_literals
import os
from django.utils.translation import ugettext_lazy as _


##
# MEZZANINE SETTINGS #
##

# The following settings are already defined with default values in
# the ``defaults.py`` module within each of Mezzanine's apps, but are
# common enough to be put here, commented out, for conveniently
# overriding. Please consult the settings documentation for a full list
# of settings Mezzanine implements:
# http://mezzanine.jupo.org/docs/configuration.html#default-settings

# Controls the ordering and grouping of the admin menu.
#
# ADMIN_MENU_ORDER = (
# ("Content", ("pages.Page", "blog.BlogPost",
#"generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
# ("Site", ("sites.Site", "redirects.Redirect", "conf.Setting")),
# ("Users", ("auth.User", "auth.Group",)),
# )

# A three item sequence, each containing a sequence of template tags
# used to render the admin dashboard.
#
# DASHBOARD_TAGS = (
# ("blog_tags.quick_blog", "mezzanine_tags.app_list"),
# ("comment_tags.recent_comments",),
# ("mezzanine_tags.recent_actions",),
# )

# A sequence of templates used by the ``page_menu`` template tag. Each
# item in the sequence is a three item sequence, containing a unique ID
# for the template, a label for the template, and the template path.
# These templates are then available for selection when editing which
# menus a page should appear in. Note that if a menu template is used
# that doesn't appear in this setting, all pages will appear in it.

# PAGE_MENU_TEMPLATES = (
# (1, _("Top navigation bar"), "pages/menus/dropdown.html"),
# (2, _("Left-hand tree"), "pages/menus/tree.html"),
# (3, _("Footer"), "pages/menus/footer.html"),
# )

# A sequence of fields that will be injected into Mezzanine's (or any
# library's) models. Each item in the sequence is a four item sequence.
# The first two items are the dotted path to the model and its field
# name to be added, and the dotted path to the field class to use for
# the field. The third and fourth items are a sequence of positional
# args and a dictionary of keyword args, to use when creating the
# field instance. When specifying the field class, the path
# ``django.models.db.`` can be omitted for regular Django model fields.
#
# EXTRA_MODEL_FIELDS = (
# (
# # Dotted path to field.
# "mezzanine.blog.models.BlogPost.image",
# # Dotted path to field class.
# "somelib.fields.ImageField",
# # Positional args for field class.
# (_("Image"),),
# # Keyword args for field class.
# {"blank": True, "upload_to": "blog"},
# ),
# # Example of adding a field to *all* of Mezzanine's content types:
# (
# "mezzanine.pages.models.Page.another_field",
# "IntegerField", # 'django.db.models.' is implied if path is omitted.
# (_("Another name"),),
# {"blank": True, "default": 1},
# ),
# )

# Setting to turn on featured images for blog posts. Defaults to False.
#
# BLOG_USE_FEATURED_IMAGE = True

# If True, the django-modeltranslation will be added to the
# INSTALLED_APPS setting.
USE_MODELTRANSLATION = False



# MAIN DJANGO SETTINGS #


# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts

ALLOWED_HOSTS = [
	'nektra.com',  # Allow domain and subdomains
	'coinfabrik.com.', # Also allow FQDN and