deploying djnago on apache

85 views
Skip to first unread message

ngangsia akumbo

unread,
Aug 7, 2014, 6:01:47 PM8/7/14
to django...@googlegroups.com
nano bluepearlhotel.wsgi


import os
import sys
sys.path = ['/var/www/bluepearlhotel'] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'bluepearlhotel.settings'
import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()




yems@yems /etc/apache2/sites-available $



<VirtualHost *:80>
WSGIScriptAlias / /home/yems/bluepearlhotel.wsgi

ServerName  bluepearlhotel.com

Alias /static /var/www/bluepearlhotel/static/

<Directory /var/www/bluepearlhotel/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

i created the project


so when i type bluepearlhotel.com

it gives me this error

Forbidden

You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at bluepearlhotel.com Port 80





Collin Anderson

unread,
Aug 7, 2014, 6:14:46 PM8/7/14
to django...@googlegroups.com
add:

    <Directory /home/yems/>
    <Files bluepearlhotel.py>
    Require all granted
    </Files>
    </Directory>

ngangsia akumbo

unread,
Aug 7, 2014, 6:25:48 PM8/7/14
to django...@googlegroups.com
ahouls i add it like this

  GNU nano 2.2.6           File: bluepearlhotel.conf                           

<VirtualHost *:80>
WSGIScriptAlias / /home/yems/bluepearlhotel.wsgi

ServerName  bluepearlhotel.com

Alias /static /var/www/bluepearlhotel/static/

<Directory /var/www/bluepearlhotel/>
Order allow,deny
Allow from all
</Directory>


</VirtualHost>

Collin Anderson

unread,
Aug 7, 2014, 6:45:34 PM8/7/14
to django...@googlegroups.com
yeah did that work?

Collin Anderson

unread,
Aug 7, 2014, 6:46:43 PM8/7/14
to django...@googlegroups.com
sorry, my bad, should be:
<Files bluepearlhotel.wsgi> not py

ngangsia akumbo

unread,
Aug 8, 2014, 8:36:04 AM8/8/14
to django...@googlegroups.com
Thanks bro for the help you are giving me

but after adding that i realease a strange behavior this morning

my database name is bluepearlhotel on mysql
mi website domain name i set for apache is bluepearlhotel
when i open the bluepearlhotel  site name it toke me to the mysql pphpmyadmin , listing all the files we have in the databse of the main server.

since we have a home group share
how do i open the site bluepearlhotel  ?
i am confused with this kind of behavior
Message has been deleted
Message has been deleted

Collin Anderson

unread,
Aug 8, 2014, 12:43:58 PM8/8/14
to django...@googlegroups.com
<VirtualHost *:80>
WSGIScriptAlias / /home/yems/bluepearlhotel.wsgi

ServerName  bluepearlhotel.com

Alias /static /var/www/bluepearlhotel/static/

<Directory /var/www/bluepearlhotel/>
Order allow,deny
Allow from all
</Directory>

<Directory /home/yems/>
<Files bluepearlhotel.wsgi>

Require all granted
</Files>
</Directory>

</VirtualHost>

ngangsia akumbo

unread,
Aug 8, 2014, 1:40:33 PM8/8/14
to django...@googlegroups.com
Thanks bro am drawing closer to the solution
i got this error when i types
 www.bluepearlhotel.com

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


i have 4 apps withing the project bluepearlhotel

François Schiettecatte

unread,
Aug 8, 2014, 1:45:33 PM8/8/14
to django...@googlegroups.com
You should check your web server's error_log, there might be something there which would help.

François
> --
> 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/140db4f8-d12d-4761-bcdc-d3f5ce0ac90f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

ngangsia akumbo

unread,
Aug 8, 2014, 2:22:01 PM8/8/14
to django...@googlegroups.com

[Fri Aug 08 14:49:13.738547 2014] [:error] [pid 4517:tid 2998897472] [client 19$
[Fri Aug 08 14:49:13.738584 2014] [:error] [pid 4517:tid 2998897472] [client 19$
[Fri Aug 08 14:49:13.738619 2014] [:error] [pid 4517:tid 2998897472] [client 19$


some example of error_log

tea...@gmail.com

unread,
Aug 9, 2014, 2:59:15 PM8/9/14
to django...@googlegroups.com

ngangsia akumbo

unread,
Aug 11, 2014, 7:41:40 AM8/11/14
to django...@googlegroups.com
thanks bro

ngangsia akumbo

unread,
Aug 11, 2014, 1:47:09 PM8/11/14
to django...@googlegroups.com
i have these configs

project path
yems bluepearlhotel # ls
blog  bluepearlhotel  event  gallery  home  images  manage.py  media  static
yems bluepearlhotel # 


cd /etc/apcahe2/sites-available

 yems sites-available # ls
000-default.conf  bluepearlhotel.conf  default-ssl.conf  testsite.com
yems sites-available # 


VirtualHost *:80>
WSGIScriptAlias / /home/yems/bluepearlhotel.wsgi

ServerName  bluepearlhotel.com

Alias /static /var/www/bluepearlhotel/static/

<Directory /home/yems/var/www/bluepearlhotel/>
Order allow,deny
Allow from all
</Directory>

<Directory /home/yems/>
<Files bluepearlhotel.wsgi>

Require all granted
</Files>
</Directory>



yems@yems ~ $ ls
bluepearlhotel.wsgi 

import os
import sys
sys.path = ['home/home/var/www/bluepearlhotel'] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'bluepearlhotel.settings'
import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

when i browse 

it give me an empty page

Please need help

ngangsia akumbo

unread,
Aug 11, 2014, 3:49:55 PM8/11/14
to django...@googlegroups.com
some help here please

Sanjay Bhangar

unread,
Aug 11, 2014, 3:52:11 PM8/11/14
to django...@googlegroups.com
hey Ngangsia,


On Mon, Aug 11, 2014 at 7:17 PM, ngangsia akumbo <ngan...@gmail.com> wrote:
> i have these configs
>
> project path
> yems bluepearlhotel # ls
> blog bluepearlhotel event gallery home images manage.py media static
> yems bluepearlhotel #
>
>
> cd /etc/apcahe2/sites-available
>
> yems sites-available # ls
> 000-default.conf bluepearlhotel.conf default-ssl.conf testsite.com
> yems sites-available #
>

The config you are using here is testsite.com or bluepearlhotel.conf ?
Recently, apache changed their default config to only look for files
ending in .conf inside sites-available, iirc, so if your config is in
testsite.com, maybe its not reading your config at all.

>
> VirtualHost *:80>
> WSGIScriptAlias / /home/yems/bluepearlhotel.wsgi
>
> ServerName bluepearlhotel.com
>
> Alias /static /var/www/bluepearlhotel/static/
>
> <Directory /home/yems/var/www/bluepearlhotel/>
> Order allow,deny
> Allow from all
> </Directory>
>
> <Directory /home/yems/>
> <Files bluepearlhotel.wsgi>
>
> Require all granted
> </Files>
> </Directory>
>

That *looks* okay. Can you add a couple lines for log files, and then
check those files to see if you get anything in the logs that maybe
helpful? Like this:

ErrorLog /var/log/apache2/bluepearlhotel.com_error.log
CustomLog /var/log/apache2/bluepearlhotel.com_access.log combined

Also, your /static alias seems off? Where exactly are your project
files? If your project folder is /home/yems/var/www/bluepearlhotel
your static path should probably be something like
/home/yems/var/www/bluepearlhotel/static or so?

Can you paste output of the command 'pwd' inside your project folder?

>
>
> yems@yems ~ $ ls
> bluepearlhotel.wsgi
>
> import os
> import sys
> sys.path = ['home/home/var/www/bluepearlhotel'] + sys.path
> os.environ['DJANGO_SETTINGS_MODULE'] = 'bluepearlhotel.settings'
> import django.core.handlers.wsgi
>
> application = django.core.handlers.wsgi.WSGIHandler()
>
> when i browse
>
> www.bluepearlhotel.com
> it give me an empty page
>
> Please need help
>

Again, that *seems* okay, but perhaps you have something weird going
on with your paths.

I'd check the apache log files, one of two things could happen then:

1> You don't see any errors for bluepearlhotel.com -- in this case,
your apache conf is probably not being read at all. Have you done
a2enmod on the vhost file? Can you check if there is an entry /
symlink inside /etc/apache2/sites-enabled/ (post output of 'ls
/etc/apache2/sites-enabled'). Then, first need to figure out why the
conf files is not being read.

2> If the conf file is being read, you should see some errors. Those
errors should give you some more information about what's going wrong.
Paste those errors here and we can try and help you out.

Don't give up, lets figure this out :P

-Sanjay

ngangsia akumbo

unread,
Aug 12, 2014, 9:11:25 AM8/12/14
to django...@googlegroups.com
This is what i have for errors
  • yems@yems /var/log/apache2 $ ls
access.log    error.log    other_vhosts_access.log
access.log.1  error.log.1  other_vhosts_access.log.1


static path

  • yems@yems /var/www/bluepearlhotel $ ls
blog  bluepearlhotel  event  gallery  home  images  manage.py  media  static

app listed are blog, event, gallery, home, images, a

and the project name is bluepearlhotel


i have also done the a2ensite bluepearlhotel.conf  it gave me this message

  • yems@yems /etc/apache2/sites-available $ a2ensite bluepearlhotel.conf
Site bluepearlhotel already enabled

the out pu of  /etc/apache2/sites-available


  • yems@yems /etc/apache2/sites-available $ ls
000-default.conf  bluepearlhotel.conf  default-ssl.conf  testsite.com



config files are not being read


There are no erros at the bluepearlhotel 

Sanjay Bhangar

unread,
Aug 12, 2014, 9:33:05 AM8/12/14
to django...@googlegroups.com
On Tue, Aug 12, 2014 at 2:41 PM, ngangsia akumbo <ngan...@gmail.com> wrote:
> This is what i have for errors
>
> yems@yems /var/log/apache2 $ ls
>
> access.log error.log other_vhosts_access.log
> access.log.1 error.log.1 other_vhosts_access.log.1
>

If you have not added a specific ErrorLog and CustomLog directive for
this vhost file (as per my previous email), apache will club all
access and error logs into the default access and error log files.

>
> static path
>
> yems@yems /var/www/bluepearlhotel $ ls
>
> blog bluepearlhotel event gallery home images manage.py media static
>
> app listed are blog, event, gallery, home, images, a
>
> and the project name is bluepearlhotel
>

You seemed to have your paths in your vhost conf as like
"/home/yems/var/ww/..." whereas your path seems to be /var/www/..
(without the /home/yems .. )

>
> i have also done the a2ensite bluepearlhotel.conf it gave me this message
>
> yems@yems /etc/apache2/sites-available $ a2ensite bluepearlhotel.conf
>
> Site bluepearlhotel already enabled
>
> the out pu of /etc/apache2/sites-available
>
>
> yems@yems /etc/apache2/sites-available $ ls
>
> 000-default.conf bluepearlhotel.conf default-ssl.conf testsite.com
>
>
>
> config files are not being read
>

There seem to be several little silly things that could be the issue
here - its a bit hard to tell from out here - if you feel like, ping
me on chat (sanjayb on IRC/Freenode or my current email address on
google-chat) -- we can go over these things step by step and make sure
things are in order.

Cheers,
Sanjay
> --
> 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/90e65b15-a61b-4318-a82f-2aa0f866e371%40googlegroups.com.

ngangsia akumbo

unread,
Aug 12, 2014, 9:38:32 AM8/12/14
to django...@googlegroups.com
ok thanks bro i am not familia with google chat i have skyp 

skype is ngangsi.richard

ngangsia akumbo

unread,
Aug 12, 2014, 9:48:40 AM8/12/14
to django...@googlegroups.com
is the skype ok or facebook

ngangsia (at) yahoo.com
Reply all
Reply to author
Forward
0 new messages