Two projects fail to import the same main app when I turn on both in Apache

17 views
Skip to first unread message

Thomas Levine

unread,
May 5, 2015, 5:58:37 AM5/5/15
to django...@googlegroups.com
Hi,

For like the first time ever I want to make complicated websites,
so using Django finally seems like a good idea. And it is! All the
small building blocks that I had never thought of are already here.
Anyway, the part that's relevant to my present concern is that I
haven't deployed Django many times before and thus don't really know
what I'm doing.

I have two sites that I want to host on the same computer.
I have root access on this computer. The two sites are called
"dadaportal", which is on https://thomaslevine.com, and "scott",
which is on http://scott.dada.pink.

I also have a bunch of other sites configured in Apache, but
none of those uses wsgi or even Python.

Both sites work fine if I disable the other. Here is what its
configuration looks like.
http://big.dada.pink/010-dadaportal.conf
http://dada.pink/dadaportal/dadaportal/wsgi.py
http://dada.pink/dadaportal/dadaportal/settings.py

And here is the other.
http://big.dada.pink/015-scott.conf
http://dada.pink/scott2/scott2/wsgi.py
http://dada.pink/scott2/scott2/settings.py

I have problem when I try to run both at the same time.
The 010-dadaportal.conf and 015-scott.conf are in my
/etc/apache2/sites-available directory, so I have been
enabling them and disabling them like this.

a2dissite 010-dadaportal && a2ensite 015-scott &&
service apache2 reload && sleep 1s &&
a2dissite 015-scott && a2ensite 010-dadaportal &&
service apache2 reload

If I disable both of them and access either one in a web
browser, this shows up in the error log corresponding to
the If I try to access either one.

[Tue May 05 09:10:14.433772 2015] [wsgi:error] [pid 4155] [remote 79.136.47.106:512] ImportError: No module named 'dadaportal'

For example, here is a line from /var/log/apache2/scott2-error.log,

[Tue May 05 09:10:14.433772 2015] [wsgi:error] [pid 4155] [remote 79.136.47.106:512] ImportError: No module named 'dadaportal'

and here is one from /var/log/apache2/dadaportal-error.log.

[Tue May 05 09:13:01.552357 2015] [wsgi:error] [pid 4338] [remote 79.136.47.106:512] ImportError: No module named 'dadaportal'

Note that both projects look for "dadaportal". dadaportal is the
app containing the settings file in the dadaportal project.
http://dada.pink/dadaportal/manage.py

It is not in the scott2 project; I checked by running the following
command from the root of the scott2 project.

$ grep --include='*.py' -r dadaportal .

It printed nothing. Here are versions of things.

$ pip3 freeze|grep Django
Django==1.8.1
$ python3 --version
Python 3.4.2

Any idea of what I'm doing incorrectly? Thanks

Tom

Tom Evans

unread,
May 5, 2015, 8:50:04 AM5/5/15
to django...@googlegroups.com
On Tue, May 5, 2015 at 10:32 AM, Thomas Levine <_@thomaslevine.com> wrote:
> Hi,
>
> For like the first time ever I want to make complicated websites,
> so using Django finally seems like a good idea. And it is! All the
> small building blocks that I had never thought of are already here.
> Anyway, the part that's relevant to my present concern is that I
> haven't deployed Django many times before and thus don't really know
> what I'm doing.
>
> I have two sites that I want to host on the same computer.
> I have root access on this computer. The two sites are called
> "dadaportal", which is on https://thomaslevine.com, and "scott",
> which is on http://scott.dada.pink.
>
> I also have a bunch of other sites configured in Apache, but
> none of those uses wsgi or even Python.
>
> Both sites work fine if I disable the other. Here is what its
> configuration looks like.
> http://big.dada.pink/010-dadaportal.conf
> http://dada.pink/dadaportal/dadaportal/wsgi.py
> http://dada.pink/dadaportal/dadaportal/settings.py
>
> And here is the other.
> http://big.dada.pink/015-scott.conf
> http://dada.pink/scott2/scott2/wsgi.py
> http://dada.pink/scott2/scott2/settings.py
>
> I have problem when I try to run both at the same time.

You're missing the process-group argument from WSGIScriptAlias so it
tries to run both of them in the default process group.

https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/modwsgi/#using-mod-wsgi-daemon-mode

Cheers

Tom

Thomas Levine

unread,
May 7, 2015, 8:56:02 AM5/7/15
to django...@googlegroups.com
Indeed! Thanks

Tom
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1%2B7ag9RiJrQ6dUPzADOss5dN2zWxrmpH3zHkF%2BsCP-eNQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages