Wpis z mikrobloga

Hej, mam mały problem z url'sami w django i w sumie nie wiem z czego on wynika. Ale po kolei:

moje główne urls.py :



from
```**```
 django.conf.urls 
```**```
import
```**```
 patterns, include, url

```**```
from
```**```
 django.contrib 
```**```
import
```**```
 admin

admin.autodiscover()

``````

urlpatterns = patterns(
```_```
''
```_```
,

    
```#```
 editor

    url(
```_```
r'^editor/'
```_```
, include(
```_```
'editor.urls'
```_```
))

)

```url's editor app:**```
from
```**```
 django.conf.urls 
```**```
import
```**```
 patterns, include, url

``````

urlpatterns = patterns(

    
```_```
''
```_```
,

    url(
```_```
r'^$'
```_```

```_```
'editor.views.index'
```_```
, name=
```_```
'index'
```_```
),

)

```**views.py** z editor'a:**```
from
```**```
 django.shortcuts 
```**```
import
```**```
 render

```**```
def
```**```
 index(request):

    
```#```
 now return the rendered template

    
```**```
return
```**```
 render(request, 
```_```
'editor/index.html'
```_```
)

Co tu może być nie tak? Po wejściu na localhost/editor/ wywala "No Post matches the given query". Jak sobie zmienię w url'sach editora z '^$' na np. 'list' i wejdę na localhost/editor/list to wszystko działa...

#django #python #webdev
  • 7
@Dyzajash: w Django raczkuje, ale czy czasem się nie rozpędziłeś w editor/urls.py?

from django.conf.urls import patterns, include, url

from .views import index

[..]

url(r'^$', index, name='index'),
lub

(r'^$', 'editor.views.index', name='index'),