我刚刚克隆的公司代码出现“页面未找到(404)”错误,应该是可以正常工作的。代码有什么问题吗?

2024-09-29 22:22:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我和一个同事在从我们的存储库中克隆Central Desk网站时遇到了同样的问题。这是给我们的网页找不到(404)错误,我们不知道为什么。代码应该工作良好,考虑到它的代码为我们的网站

我尝试过它连接到我们的VPN和未连接,我已经重新启动克隆过程和重做一切,我仍然得到错误。我试过让Redis在保护模式下运行,但什么都没用。我查看了url.py文件和settings\u 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/'))

上面第一个是url.py文件,第二个是settings\u development.py文件。我们只希望能够到达预期的页面


Tags: appsthetopathdjangofromimporturl
1条回答
网友
1楼 · 发布于 2024-09-29 22:22:20

别客气!对于那些想知道的人,要在本地主机上编辑,我们在主机上有一个用于Central Desk的应用程序,因此该应用程序的URL是: 127.0.0.1:8000/应用程序/中央磁盘

至少这是我猜测为什么我们要去那个网址的最佳机会

相关问题 更多 >

    热门问题