deploy ?

78 views
Skip to first unread message

Diogene Laerce

unread,
Oct 11, 2013, 6:49:10 AM10/11/13
to django...@googlegroups.com
Hi,

I'd like to deploy my first "hello world" app on localhost but I can't get
through the first attribution url even after openclassrooms tuto :

I've got :

app/urls.py
urlpatterns = patterns('',
url(r'^accueil/$', 'portal.views.home'),
)

app/portal/views.py
from django.http import HttpResponse
def home(request):
text = """<h1>Bienvenue sur mon blog !</h1>
<p>Les cr�pes bretonnes �a tue des mouettes en plein vol !</p>
"""
return HttpResponse(text)

settings.py
DEBUG = True
ALLOWED_HOSTS = ['127.0.1.1/site.test']
STATIC_URL = '/static/'
STATICFILES_DIRS = (
'/var/www/site.test/app/static/',
)
ROOT_URLCONF = 'app.urls'
WSGI_APPLICATION = 'app.wsgi.application'
TEMPLATE_DIRS = (
'/var/www/site.test/app/templates'
)
INSTALLED_APPS = (
.
.
.
# 'django.contrib.admindocs',
'portal',
)


and then get this django error - which means that django is functional
on the localhost I guess :

Using the URLconf defined in |app.urls |, Django tried these URL
patterns, in this order:

1. ^accueil/$
2. ^static\/(?P<path>.*)$

The current URL, |site.test/accueil <http://site.test/accueil>|, didn't
match any of these.


I don't get what I am doing wrong.

Thanks to help.

--
�One original thought is worth a thousand mindless quotings.�
�Le vrai n'est pas plus s�r que le probable.�

Diogene Laerce

yati sagade

unread,
Oct 11, 2013, 6:53:56 AM10/11/13
to django...@googlegroups.com
I assume `site.test` is set to point to localhost in your /etc/hosts file (or the HOSTS file on Windows). Then, try http://site.test/accueil/ (notice the trailing slash). If that doesn't work, just try `localhost:8000/accueil/` (replace 8000 with the port you're running on, of course) to see if all is well.


On Fri, Oct 11, 2013 at 4:19 PM, Diogene Laerce <me_bu...@yahoo.fr> wrote:
Hi,

I'd like to deploy my first "hello world" app on localhost but I can't get
through the first attribution url even after openclassrooms tuto :

I've got :

app/urls.py
urlpatterns = patterns('',
url(r'^accueil/$', 'portal.views.home'),
)

app/portal/views.py
from django.http import HttpResponse
def home(request):
text = """<h1>Bienvenue sur mon blog !</h1>
<p>Les crêpes bretonnes ça tue des mouettes en plein vol !</p>


--
“One original thought is worth a thousand mindless quotings.”
“Le vrai n'est pas plus sûr que le probable.”

                                              Diogene Laerce

--
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+unsubscribe@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/5257D7A6.8060202%40yahoo.fr.
For more options, visit https://groups.google.com/groups/opt_out.



--
Yati Sagade

Software Engineer at mquotient

Twitter: @yati_itay | Github: yati-sagade

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869

Diogene Laerce

unread,
Oct 11, 2013, 8:56:19 AM10/11/13
to django...@googlegroups.com

I decided to redo everything from the /var/www folder and it seems to work.
But that leads me to another question :

previously I formed the application in my home folder and I thought that
transfering
the app folder to the website test folder, and updating all links in
settings.py would be
enough to run it from apache. But the actual experiment shows that I was
wrong.

Can somebody explain to me why ? Or was I right to think that and then I did
miss another update in the files elsewhere ?

Thanks

Diogene Laerce

unread,
Oct 11, 2013, 11:40:44 AM10/11/13
to django...@googlegroups.com
Actually the default django server works but I can't get apache to serve the
app ? Anyone ?

Lukas Nemec

unread,
Oct 11, 2013, 1:19:04 PM10/11/13
to django...@googlegroups.com
Why do you want apache? It is not as good as say Nginx with UWSGI or
gunicorn...
And there is a lot of information about this. ..

http://nemec.lu/en/how-to#django-nginx-uwsgi-ssl

enjoy

Cody Chamberlain

unread,
Oct 11, 2013, 1:57:14 PM10/11/13
to django...@googlegroups.com, me_bu...@yahoo.fr
Have you enabled the necessary WSGI modules in Apache and performed the necessary configuration? You have to remember that the Django python files need an application server to compile and process. Apache out of the box doesn't do that. mod_wshi is one option. The others are using Nginx as a reverse proxy to the Gunicorn application server. 

I recommend reading the following:

Diogene Laerce

unread,
Oct 12, 2013, 4:51:17 AM10/12/13
to django...@googlegroups.com

> Have you enabled the necessary WSGI modules in Apache and performed
> the necessary configuration? You have to remember that the Django
> python files need an application server to compile and process. Apache
> out of the box doesn't do that. mod_wshi is one option.

I guess you mean mod_wsgi cos I didn't find info on wshi. :)

Anyway I solved the problem : django pointed the url on localhost root. I
tried every combination of urls before except this one.

> The others are using Nginx as a reverse proxy to the Gunicorn
> application server.

I had a look on those and I'd like to be sure of what I understood : I can
use 2 http servers, gunicorn for dynamic contents and nginx for static
contents. And all that, through a virtual environment (my workstation :
debian squeeze) served by pythonbrew. Yes ?

But I saw that some people use uwsgi too, on their website they say it
is for hosting purpose. So unless I need to run multiples domain names
on the same host, I do not need it, do I ?

Thank you

Lukáš Němec

unread,
Oct 12, 2013, 1:35:29 PM10/12/13
to django...@googlegroups.com
You can use nxinx with uwsgi even with several domain names, nginx takes
care of that, you just run several uwsgi/gunicorn processes on different
tcp ports or unix sockets, and nginx will just select the one that fits
for its domain name (set in config) of course you need to set it properly..

Anyways, when you want to host multiple python sites with
nginx/something, I'd recommend uwsgi with supervisor .. which will help
you manage the apps really easy ... of course you can use gunicorn
instead of uwsgi ... it is up to you ...

Lukas


Dne 12. 10. 2013 10:51, Diogene Laerce napsal(a):

Diogene Laerce

unread,
Oct 12, 2013, 9:43:31 PM10/12/13
to django...@googlegroups.com

> You can use nxinx with uwsgi even with several domain names, nginx
> takes care of that, you just run several uwsgi/gunicorn processes on
> different tcp ports or unix sockets, and nginx will just select the
> one that fits for its domain name (set in config) of course you need
> to set it properly..
>
> Anyways, when you want to host multiple python sites with
> nginx/something, I'd recommend uwsgi with supervisor .. which will
> help you manage the apps really easy ... of course you can use
> gunicorn instead of uwsgi ... it is up to you ...

So I will go for : nginx + uwsgi + supervisor + django !

Thanks for the enlightenment !


>
> Lukas
>
>
> Dne 12. 10. 2013 10:51, Diogene Laerce napsal(a):
>>
>>> Have you enabled the necessary WSGI modules in Apache and performed
>>> the necessary configuration? You have to remember that the Django
>>> python files need an application server to compile and process. Apache
>>> out of the box doesn't do that. mod_wshi is one option.
>>
>> I guess you mean mod_wsgi cos I didn't find info on wshi. :)
>>
>> Anyway I solved the problem : django pointed the url on localhost
>> root. I
>> tried every combination of urls before except this one.
>>
>>> The others are using Nginx as a reverse proxy to the Gunicorn
>>> application server.
>>
>> I had a look on those and I'd like to be sure of what I understood :
>> I can
>> use 2 http servers, gunicorn for dynamic contents and nginx for static
>> contents. And all that, through a virtual environment (my workstation :
>> debian squeeze) served by pythonbrew. Yes ?
>>
>> But I saw that some people use uwsgi too, on their website they say it
>> is for hosting purpose. So unless I need to run multiples domain names
>> on the same host, I do not need it, do I ?
>>
>> Thank you
>>
>

Diogene Laerce

unread,
Oct 16, 2013, 2:20:13 AM10/16/13
to django...@googlegroups.com

>
>> You can use nxinx with uwsgi even with several domain names, nginx
>> takes care of that, you just run several uwsgi/gunicorn processes on
>> different tcp ports or unix sockets, and nginx will just select the
>> one that fits for its domain name (set in config) of course you need
>> to set it properly..
>>
>> Anyways, when you want to host multiple python sites with
>> nginx/something, I'd recommend uwsgi with supervisor .. which will
>> help you manage the apps really easy ... of course you can use
>> gunicorn instead of uwsgi ... it is up to you ...
>
> So I will go for : nginx + uwsgi + supervisor + django !

Ok everything runs fine now ! Except :..

If I well understood uwsgi is supposed to update every code changes so
that I don't need to restart the all bundle but it still does not work :
I do
need to restart everything ? Actually I need to kill all processes first and
after restart everything ?

/debian squeeze + nginx 1.2.1 (extra package) + uwsgi 1.9.18.1 +
supervisor 3.0a.8/
Reply all
Reply to author
Forward
0 new messages