slyapustin / django-classified

Django Classified
https://github.com/slyapustin/django-classified-demo
MIT License
171 stars 77 forks source link

instal problems #29

Closed samazaphikel closed 5 years ago

samazaphikel commented 5 years ago

Hi,

after installation requirements, I have two issues.

1. RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

I changed in the source two lines in django_classified\urls.py


# -*- coding:utf-8 -*-
from django.conf.urls import url
from django.contrib.auth.views import LogoutView
from django.contrib.sitemaps.views import sitemap as sitemap_view
from django.views.decorators.cache import cache_page, never_cache

**from . import views, sitemap#, feeds**

app_name = 'django_classified'

urlpatterns = [
    url(r'^$', views.SectionListView.as_view(), name='index'),
    url(r'^new/$', never_cache(views.ItemCreateView.as_view()), name='item-new'),
    url(r'^edit/(?P<pk>\d+)/$', never_cache(views.ItemUpdateView.as_view()), name='item-edit'),
    url(r'^(?P<pk>\d+)-(?P<slug>[-\w]+)/$', views.ItemDetailView.as_view(), name='item'),
    url(r'^group/(?P<pk>\d+)-(?P<slug>[-\w]+)/$', views.GroupDetail.as_view(), name='group'),
    url(r'^search/', views.SearchView.as_view(), name='search'),
    url(r'^robots\.txt$', cache_page(60 * 60)(views.RobotsView.as_view()), name='robots'),
    url(r'^sitemap\.xml$', sitemap_view, {'sitemaps': sitemap.sitemaps_dict}, name='sitemap'),
    **#url(r'^rss\.xml$', cache_page(60 * 15)(feeds.LatestItemFeed()), name='rss'),**
    url(r'^user/$', views.MyItemsView.as_view(), name='user-items'),
    url(r'^user/profile/$', views.ProfileView.as_view(), name='profile'),
    url(r'^user/my/delete/(?P<pk>\d+)/$', views.ItemDeleteView.as_view(), name='my-delete'),
    url(r'^user/logout/$', LogoutView.as_view(), name='logout'),
    url(r'^user/set-area/$', views.SetAreaView.as_view(), name='set-area'),
]

After this running via console is possible: python manage.py runserver

But when Iclick on login button Top-Right, I get this error

Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/accounts/login/?next=/user/profile/

Maybe you can prvide me help?

slyapustin commented 5 years ago

@samazaphikel Can you please provide me list of the packages installed via pip list?

samazaphikel commented 5 years ago

pip freeze

apiclient==1.0.3
asn1crypto==0.24.0
boto3==1.7.45
botocore==1.10.84
cachetools==3.0.0
certifi==2018.11.29
cffi==1.11.5
chardet==3.0.4
cryptography==2.4.2
defusedxml==0.5.0
dj-database-url==0.5.0
Django==2.1
django-appconf==1.0.2
django-cors-headers==2.4.0
django-daterange-filter==1.3.0
django-storages==1.6.6
django-tinymce4-lite==1.7.4
django-widget-tweaks==1.4.2
docutils==0.14
google-api-python-client==1.7.7
google-auth==1.6.2
google-auth-httplib2==0.0.3
httplib2==0.12.0
idna==2.8
jmespath==0.9.3
jsmin==2.2.2
jsonfield==2.0.2
mysqlclient==1.4.1
oauth2client==4.1.3
oauthlib==3.0.0
psycopg2==2.7.5
pyasn1==0.4.5
pyasn1-modules==0.2.3
pycparser==2.19
PyJWT==1.7.1
PyMySQL==0.9.3
python-dateutil==2.7.5
python-decouple==3.1
python3-openid==3.1.0
pytz==2018.9
requests==2.21.0
requests-oauthlib==1.2.0
rsa==4.0
s3transfer==0.1.13
six==1.12.0
social-auth-app-django==2.1.0
social-auth-core==3.0.0
uritemplate==3.0.0
urllib3==1.24.1

python -V Python 3.7.2

slyapustin commented 5 years ago

@samazaphikel I found the issue. Django does not include 'django.contrib.sites' app into the default INSTALLED_APPS list. So you also need to do that manually:

INSTALLED_APPS = [
...
'django.contrib.sites',
...
]