Saturday 13 February 2021

TypeError: argument of type 'WindowsPath' is not iterable

 Please make to modify settings.py file:


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': str(os.path.join(BASE_DIR, "db.sqlite3"))

} 

Friday 9 October 2020

'staticfiles' is not a registered tag library.

 {% load staticfiles %} and {% load admin_static %} were deprecated in django 2.1, and removed in django 3.1.

If you have any of the following in your template:

{% load staticfiles %}
{% load static from staticfiles %}
{% load admin_static %}

You should replace the tag with simply:

{% load static %}

Thursday 14 May 2020

GITHUB: Add/ Push a folder to git


1. Initialize the Git Repo
     git init

2. Add the files to Git index
    git add -A

3. Commit Added Files
    git commit -m "my commit"

4. Add new remote origin (GitHub)
    git remote add origin git@....

5. Push to GitHub
git push -u -f origin master

Tuesday 21 January 2020

URL Mapping

from django.contrib import admin
from django.urls import path
from django.conf.urls import include


urlpatterns= [
   path('admin/', admin.site.urls),
   path('', include('DJP.urls')),
]



from django.urls import path
from . import views
from django.conf.urls import url

from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()

urlpatterns = [
    path('', views.home, name'home'),
   # url(r'^home/(?P<id>\d+)/$', views.data, name= 'data'),
]



from django.shortcuts import render

# Create your views here.

from .models import *

# Create your views here.

def home(request):
    return render(request, 'DJP/home.html')








Monday 1 July 2019

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?

Make sure mysqlclient is installed in your system then add below code in __init__.py file

import pymysql
pymysql.install_as_MySQLdb()

TypeError: argument of type 'WindowsPath' is not iterable

 Please make to modify settings.py file: DATABASES = { 'default' : { 'ENGINE' : 'django.db.backends.sqlite3&...