Django重定向在electron.js中不起作用

时间:2019-06-28 06:02:51

标签: django electron

我正在为我父亲的公司创建一个帐户管理应用程序。我像这样将Django与电子集成在一起:

mainWindow.loadURL('http://localhost:8000')

package.json中:

"start": "start python manage.py runserver && start electron ."

在我的 createView,DetailView,DeleteView 中。我添加了这个:

success_url = reverse_lazy('home')

如果我在chrome浏览器中打开它,则可以正常工作,不用担心。 但是如果我在电子中做到这一点。它显示了此味精

Page not found (404) Request Method: GET Request URL: http://localhost:8000/delete/11 Raised by: accounts.views.EntryDeleteView

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

您在这里@Shahul Hameed

~~所有进口~~

class EntryListView(ListView):
    model = Entries
    template_name = 'accounts/home.html'

class EntryDetailView(DetailView):
    model = Entries

class EntryCreateView(CreateView):
    model = Entries
    fields = [~~All fields~~]
    success_url = reverse_lazy('home')

class EntryUpdateView(UpdateView):
    model = Entries
    fields = [~~All fields~~]
    success_url = reverse_lazy('home')

class EntryDeleteView(DeleteView):
    model = Entries
    success_url = reverse_lazy('home')