我刚刚克隆并且应该工作的公司代码上找不到页面(404)错误。代码有什么问题吗?

问题描述 投票:0回答:1

当我们从我们的存储库中克隆Central Desk网站时,我和同事会遇到同样的问题。它给了我们页面未找到(404)错误,我们不知道为什么。考虑到我们网站的代码,代码应该可以正常工作。

我已经尝试将它连接到我们的VPN并且没有连接,我重新启动了克隆过程并重做了所有内容,但我仍然得到了错误。我试过让Redis处于保护模式并且没有任何效果。我查看了我们的urls.py文件和settings_development.py文件,它们看起来都没问题。

from django.conf.urls import include, url
from django.views.generic import RedirectView
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.views import logout_then_login

from heart.views import DashBoard, get_names
from heart.forms import LoginForm
from heart.login import login_set_desk
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns =[
        # Examples:
        # url(r'^apps/central_desk/$', 'centraldesk.views.home', name='home'),
        # url(r'^apps/central_desk/centraldesk/', include('centraldesk.foo.urls')),

        # Uncomment the admin/doc line below to enable admin documentation:
        # url(r'^apps/central_desk/admin/doc/', include('django.contrib.admindocs.urls')),

        # Uncomment the next line to enable the admin:
        url(r'^apps/centraldesk/helm/', include(admin.site.urls)),
        url(r'^apps/centraldesk/heart/', include('heart.urls')),
        url(r'^apps/centraldesk/items/', include('item_tracker.urls')),
        url(r'^apps/centraldesk/lost_and_found/', include('lost_and_found.urls')),
        url(r'^apps/centraldesk/mail/', include('mail.urls')),
        url(r'^apps/centraldesk/login/$', login_set_desk, name="login"),
        url(r'^apps/centraldesk/dashboard/$', DashBoard.as_view(), name="dashboard"),
        url(r'^apps/centraldesk/logout/$', logout_then_login, name="logout"),
        url(r'^apps/centraldesk/forum/', include('forums.urls', namespace='forums')),
        url(r'^apps/centraldesk/comm/', include('comm_log.urls')),
        url(r'^apps/centraldesk/checkin/', include('checkin.urls')),
        url(r'^apps/centraldesk/residents/', get_names ),
        url(r'^apps/centraldesk/$', RedirectView.as_view(url=reverse_lazy('dashboard'), permanent=True)),
        url(r'^apps/centraldesk/cash_drawer/', include('cash_drawer.urls')),
        url(r'^apps/centraldesk/reports/', include('reports.urls')),
        url(r'^apps/centraldesk/feedback/', include('feedback.urls')),

]

from .settings_general import *

# debug value is referenced in mail/models.py to determine whether the mailer send function is called.
DEBUG = True

AUTHENTICATION_BACKENDS = (
    'techops.django_auth.backends.ActiveDirectoryBackend',
    'django.contrib.auth.backends.ModelBackend',
)

"""Emails are sent with mail creation. It's found in mail/models.py."""
SEND_EMAILS = False

REDIS_HOST = "127.0.0.1"
REDIS_NAMES_DB = 9

DATABASES = {
    'default': {
        'ENGINE'  : 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME'    : 'vagrant',                      # Or path to database file if using sqlite3.
        'USER'    : 'vagrant',                      # Not used with sqlite3.
        'PASSWORD': 'vagrant',                  # Not used with sqlite3.
        'HOST'    : '127.0.0.1',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT'    : '',                      # Set to empty string for default. Not used with sqlite3.
    }
}

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"

MEDIA_ROOT = os.path.normpath(os.path.join(SITE_ROOT, 'media'))

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
STATIC_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '../static/'))

上面是urls.py文件,第二个是settings_development.py文件。我们只是希望能够到达预期的页面。

python django url localhost
1个回答
0
投票

没关系!对于那些想知道的人,要在本地主机上进行编辑,我们在主机上有一个Central Desk应用程序,因此其URL为:127.0.0.1:8000 /apps / centraldesk

至少那是我最好的猜测,为什么我们必须去那个URL。

© www.soinside.com 2019 - 2024. All rights reserved.