Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Deploying Django on a server with mod_userdir [RSS Feed]

#1 May 22, 2010 02:13:31

B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Deploying Django on a server with mod_userdir


Hi everyone, I'm just starting out with Django and really enjoying it.
For a project I am trying to install it on an Apache server at school
with multiple users. The userdir module is enabled such that users can
create their own websites. I'd like to allow some of these users to
tinker with Django.

I have administrator access but need to make it easy for regular users
to deploy their own Django websites if they are so inclined. I have
installed mod_wsgi and mod_userdir, and configured everything as such:

/home/username/django/ is where their Django
application lives
/home/username/django/apache/ contains the WSGI interface file
/home/username/www/ is their website directory
/home/username/www/media/ is where their Django media
files live

example.com/~username/ is their static website
example.com/~username/django/ WSGI mounts the Django application at /
~username/django/

The problem I am having is actually accessing my test Django website.
When I attempt to access example.com/~username/django/admin/, I get
the Django 404 debug message. So, I know it's at least running
correctly. I've uncommented the three lines from urls.py to enable
admin access and added the django.contrib.admin package to
INSTALLED_APPS in settings.py. I ran syncdb.

I've tried configuring urls.py to map the admin to ~username/django/
admin and django/admin as well, with no luck. If anyone could help me
out I'd really appreciate it!

Thanks,

Benjamin Webber

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 May 22, 2010 05:37:16

Benjamin W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Deploying Django on a server with mod_userdir


It appears that Apache was not given permission to access the /home/
username/django directory and write to the database. Fixing the
permissions fixed everything.

On May 21, 6:18 pm, Ben <benjamin.web...@gmail.com> wrote:
> Hi everyone, I'm just starting out with Django and really enjoying it.
> For a project I am trying to install it on an Apache server at school
> with multiple users. The userdir module is enabled such that users can
> create their own websites. I'd like to allow some of these users to
> tinker with Django.
>
> I have administrator access but need to make it easy for regular users
> to deploy their own Django websites if they are so inclined. I have
> installed mod_wsgi and mod_userdir, and configured everything as such:
>
>         /home/username/django/                  is where their Django
> application lives
>         /home/username/django/apache/           contains the WSGI interface
> file
>         /home/username/www/                     is their website directory
>         /home/username/www/media/               is where their Django media
> files live
>
>         example.com/~username/                  is their static website
>         example.com/~username/django/   WSGI mounts the Django application at
> /
> ~username/django/
>
> The problem I am having is actually accessing my test Django website.
> When I attempt to access example.com/~username/django/admin/, I get
> the Django 404 debug message. So, I know it's at least running
> correctly. I've uncommented the three lines from urls.py to enable
> admin access and added the django.contrib.admin package to
> INSTALLED_APPS in settings.py. I ran syncdb.
>
> I've tried configuring urls.py to map the admin to ~username/django/
> admin and django/admin as well, with no luck. If anyone could help me
> out I'd really appreciate it!
>
> Thanks,
>
> Benjamin Webber
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group
> athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 May 22, 2010 06:47:16

Graham D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Deploying Django on a server with mod_userdir


On May 22, 2:37 pm, Benjamin Webber <benjamin.web...@gmail.com> wrote:
> It appears that Apache was not given permission to access the /home/
> username/django directory and write to the database. Fixing the
> permissions fixed everything.

BTW, strongly recommend you use mod_wsgi daemon mode, configuring a
separate mod_wsgi daemon process group for each distinct user, with
that daemon process running as that user and not as Apache user. This
way you aren't using embedded mode and each users code is kept
distinct, not running in the same process and no running as he same
user.

Graham

> On May 21, 6:18 pm, Ben <benjamin.web...@gmail.com> wrote:
>
>
>
>
>
> > Hi everyone, I'm just starting out with Django and really enjoying it.
> > For a project I am trying to install it on an Apache server at school
> > with multiple users. The userdir module is enabled such that users can
> > create their own websites. I'd like to allow some of these users to
> > tinker with Django.
>
> > I have administrator access but need to make it easy for regular users
> > to deploy their own Django websites if they are so inclined. I have
> > installed mod_wsgi and mod_userdir, and configured everything as such:
>
> >         /home/username/django/                  is where their Django
> > application lives
> >         /home/username/django/apache/           contains the WSGI interface
> > file
> >         /home/username/www/                     is their website directory
> >         /home/username/www/media/               is where their Django media
> > files live
>
> >         example.com/~username/                  is their static website
> >         example.com/~username/django/   WSGI mounts the Django application
> > at /
> > ~username/django/
>
> > The problem I am having is actually accessing my test Django website.
> > When I attempt to access example.com/~username/django/admin/, I get
> > the Django 404 debug message. So, I know it's at least running
> > correctly. I've uncommented the three lines from urls.py to enable
> > admin access and added the django.contrib.admin package to
> > INSTALLED_APPS in settings.py. I ran syncdb.
>
> > I've tried configuring urls.py to map the admin to ~username/django/
> > admin and django/admin as well, with no luck. If anyone could help me
> > out I'd really appreciate it!
>
> > Thanks,
>
> > Benjamin Webber
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group
> athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 June 14, 2010 01:50:35

Benjamin W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Deploying Django on a server with mod_userdir


Hi Graham, sorry for replying to you so incredibly late, I haven't had
much time to work on my project.

So the syntax of the WSGIDaemonProcess directive should be,

WSGIDaemonProcess user=username group=groupname threads=15 maximum-
requests=10000

For each individual Django user. But you state in the documentation,

> Note that this option is ignored if Apache wasn't started as the root user,
> in which case no matter what the settings, the daemon processes will
> be run as the user that Apache was started as.

On the server I'm working on, Apache runs under the www-data user, not
root. Is there no way around this?

By the way, thanks for being such an involved developer! You're very
helpful.

On May 22, 1:47 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On May 22, 2:37 pm, Benjamin Webber <benjamin.web...@gmail.com> wrote:
>
> > It appears that Apache was not given permission to access the /home/
> > username/django directory and write to the database. Fixing the
> > permissions fixed everything.
>
> BTW, strongly recommend you use mod_wsgi daemon mode, configuring a
> separate mod_wsgi daemon process group for each distinct user, with
> that daemon process running as that user and not as Apache user. This
> way you aren't using embedded mode and each users code is kept
> distinct, not running in the same process and no running as he same
> user.
>
> Graham
>
>
>
> > On May 21, 6:18 pm, Ben <benjamin.web...@gmail.com> wrote:
>
> > > Hi everyone, I'm just starting out with Django and really enjoying it.
> > > For a project I am trying to install it on an Apache server at school
> > > with multiple users. The userdir module is enabled such that users can
> > > create their own websites. I'd like to allow some of these users to
> > > tinker with Django.
>
> > > I have administrator access but need to make it easy for regular users
> > > to deploy their own Django websites if they are so inclined. I have
> > > installed mod_wsgi andmod_userdir, and configured everything as such:
>
> > >         /home/username/django/                  is where their Django
> > > application lives
> > >         /home/username/django/apache/           contains the WSGI
> > > interface file
> > >         /home/username/www/                     is their website directory
> > >         /home/username/www/media/               is where their Django
> > > media files live
>
> > >         example.com/~username/                  is their static website
> > >         example.com/~username/django/   WSGI mounts the Django
> > > application at /
> > > ~username/django/
>
> > > The problem I am having is actually accessing my test Django website.
> > > When I attempt to access example.com/~username/django/admin/, I get
> > > the Django 404 debug message. So, I know it's at least running
> > > correctly. I've uncommented the three lines from urls.py to enable
> > > admin access and added the django.contrib.admin package to
> > > INSTALLED_APPS in settings.py. I ran syncdb.
>
> > > I've tried configuring urls.py to map the admin to ~username/django/
> > > admin and django/admin as well, with no luck. If anyone could help me
> > > out I'd really appreciate it!
>
> > > Thanks,
>
> > > Benjamin Webber
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group
> > > athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group
> athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 June 14, 2010 05:36:06

Graham D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Deploying Django on a server with mod_userdir


On Jun 14, 10:50 am, Benjamin Webber <benjamin.web...@gmail.com>
wrote:
> Hi Graham, sorry for replying to you so incredibly late, I haven't had
> much time to work on my project.
>
> So the syntax of the WSGIDaemonProcess directive should be,
>
> WSGIDaemonProcess user=username group=groupname threads=15 maximum-
> requests=10000
>
> For each individual Django user. But you state in the documentation,
>
> > Note that this option is ignored if Apache wasn't started as the root user,
> > in which case no matter what the settings, the daemon processes will
> > be run as the user that Apache was started as.
>
> On the server I'm working on, Apache runs under the www-data user, not
> root. Is there no way around this?
>
> By the way, thanks for being such an involved developer! You're very
> helpful.

If your Apache is listening on port 80, it was started at root and you
just are mis understanding. The User/Group directives in Apache are
what root user switches to after having acquired privileged port 80
for Apache process.

You should actually find that there will still be one Apache process
left running as root, ie., the Apache parent process.

Thus, that comment only applies where Apache wasn't in the first
instance started as root, ie., you started it by hand from your own
user account as yourself and not as root via sudo or when system
starts up.

Graham

> On May 22, 1:47 am, Graham Dumpleton <graham.dumple...@gmail.com>
> wrote:
>
>
>
> > On May 22, 2:37 pm, Benjamin Webber <benjamin.web...@gmail.com> wrote:
>
> > > It appears that Apache was not given permission to access the /home/
> > > username/django directory and write to the database. Fixing the
> > > permissions fixed everything.
>
> > BTW, strongly recommend you use mod_wsgi daemon mode, configuring a
> > separate mod_wsgi daemon process group for each distinct user, with
> > that daemon process running as that user and not as Apache user. This
> > way you aren't using embedded mode and each users code is kept
> > distinct, not running in the same process and no running as he same
> > user.
>
> > Graham
>
> > > On May 21, 6:18 pm, Ben <benjamin.web...@gmail.com> wrote:
>
> > > > Hi everyone, I'm just starting out with Django and really enjoying it.
> > > > For a project I am trying to install it on an Apache server at school
> > > > with multiple users. The userdir module is enabled such that users can
> > > > create their own websites. I'd like to allow some of these users to
> > > > tinker with Django.
>
> > > > I have administrator access but need to make it easy for regular users
> > > > to deploy their own Django websites if they are so inclined. I have
> > > > installed mod_wsgi andmod_userdir, and configured everything as such:
>
> > > >         /home/username/django/                  is where their Django
> > > > application lives
> > > >         /home/username/django/apache/           contains the WSGI
> > > > interface file
> > > >         /home/username/www/                     is their website
> > > > directory
> > > >         /home/username/www/media/               is where their Django
> > > > media files live
>
> > > >         example.com/~username/                  is their static website
> > > >         example.com/~username/django/   WSGI mounts the Django
> > > > application at /
> > > > ~username/django/
>
> > > > The problem I am having is actually accessing my test Django website.
> > > > When I attempt to access example.com/~username/django/admin/, I get
> > > > the Django 404 debug message. So, I know it's at least running
> > > > correctly. I've uncommented the three lines from urls.py to enable
> > > > admin access and added the django.contrib.admin package to
> > > > INSTALLED_APPS in settings.py. I ran syncdb.
>
> > > > I've tried configuring urls.py to map the admin to ~username/django/
> > > > admin and django/admin as well, with no luck. If anyone could help me
> > > > out I'd really appreciate it!
>
> > > > Thanks,
>
> > > > Benjamin Webber
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Django users" group.
> > > > To post to this group, send email to django-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group
> > > > athttp://groups.google.com/group/django-users?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group
> > > athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group
> > athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Deploying Django on a server with mod_userdir [RSS Feed]

Board footer

Moderator control

Enjoy the 19th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support