I moved my project from my windows machine to Mac using GitHub
when I run python manage.py runserver
it worked fine showing my login page and since I didn't do any migration the app crashed,
so I executed python manage.py makemigrations
I thought this will solve the problem but
after that when I am trying to runserver I am getting the dejango home page also all my clasess are Undefined
and my database which is postgresql not showing any of my models in the table and make migrations showing below error every time after that
and ython manage.py migrate
showing below
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
No changes detected
setting.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts',
'xadmin',
'django_filters',
'crispy_forms',
]
database:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'crashDB',
'USER': 'postgres' ,
'PASSWORD': '1234',
'HOST': 'localhost',
}
}
what is the issue in here ?? and what is the best way to move my project from windows to Mac ?
the path in the setting:
STATIC_URL = '/static/'
MEDIA_URL = '/images/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'crash/static')
]
Crash.urls:
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('accounts.urls')),
]
accounts.urls:
path('',views.home,name='home'),
the home function in the view:
@login_required(login_url='Login')
def home(request):
TotalNumberOfOrders = Order.objects.all().count()
#orderbycustomer = Order.objects.values('customer','customer_id').annotate(dcount=Count('product_id'))
orderbycustomer= Order.objects.values('customer_id').annotate(dcount=Count('customer_id')).values('customer_id__name','dcount','customer_id')
Customers = Customer.objects.all()
Orders = Order.objects.all().order_by('-date_created')[:4]
TotalInProgress = Order.objects.filter(status__icontains='للتوصيل').count()
TotalDelivredOrders = Order.objects.filter(status__icontains='تم التوصيل').count()
TotalPindingOrders = Order.objects.filter(status__icontains='متأخر').count()
print('total of orders',orderbycustomer)
context = {
'Customers':Customers,
'TotalNumberOfOrders':TotalNumberOfOrders,
'TotalDelivredOrders':TotalDelivredOrders,
'TotalPindingOrders':TotalPindingOrders,
'TotalInProgress':TotalInProgress,
'Orders':Orders,
'orderbycustomer':orderbycustomer
}
return render(request,'accounts/dashboard.html',context)