Re: CSS not working
*@ Jani *- Tried the same no reaction in page. Please find the att (test.xlsx). *Regards,* *Yasar Arafath K* On Saturday, October 12, 2019 at 6:39:30 AM UTC+8, Jani Tiainen wrote: > > Hi. > > As you see Django indeed found your static file. > > Next step is to open up developer tools in browser and load your page. You > should be able to use it to determine was file even loaded and was your > style applied to link > > Note that if I'm not mistaken plain color only affects unvisited links and > visited link may stay different colored and thus seemingly you see that it > wasn't doing "nothing". > > > pe 11. lokak. 2019 klo 9.30 yasar arafath Kajamydeen > kirjoitti: > >> *@ Jani - Executed the given cmd, Please find the output and please >> guide me further ..* >> >> >> (mypython) C:\Users\kajamydeenya\telusko>python manage.py findstatic -v 3 >> polls/style.css >> Found 'polls/style.css' here: >> C:\Users\kajamydeenya\telusko\polls\static\polls\style.css >> Looking in the following locations: >> C:\Users\kajamydeenya\telusko\static >> C:\Users\kajamydeenya\telusko\polls\static >> >> C:\Users\kajamydeenya\telusko\mypython\lib\site-packages\django\contrib\admin\st >> >> >> >> >> *Regards,* >> *Yasar Arafath K* >> >> On Friday, October 11, 2019 at 12:30:19 PM UTC+8, Jani Tiainen wrote: >>> >>> Hi. >>> >>> You could try to diagnose issue with findstatic management command: >>> >>> ./manage.py findstatic -v 3 polls/style.css >>> >>> You should get a list of paths Django tried to look for your static file >>> (stylesheet) and of course was it found. >>> >>> >>> pe 11. lokak. 2019 klo 6.19 yasar arafath Kajamydeen >>> kirjoitti: >>> >>>> Hi All, >>>> >>>> I just added style sheet in my application but its not working , Please >>>> try to help me. >>>> >>>> >>>> Setting.py >>>> >>>> >>>> >>>> import os >>>> >>>> # Build paths inside the project like this: os.path.join(BASE_DIR, ...) >>>> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) >>>> >>>> >>>> # Quick-start development settings - unsuitable for production >>>> # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ >>>> >>>> # SECURITY WARNING: keep the secret key used in production secret! >>>> SECRET_KEY = '@$k&=42v@e7u26@0+woy#%aopsiv&55jjj$a=x2tr52f_5ipyh' >>>> >>>> # SECURITY WARNING: don't run with debug turned on in production! >>>> DEBUG = True >>>> >>>> ALLOWED_HOSTS = [] >>>> >>>> >>>> # Application definition >>>> >>>> INSTALLED_APPS = [ >>>> 'polls.apps.PollsConfig', >>>> 'django.contrib.admin', >>>> 'django.contrib.auth', >>>> 'django.contrib.contenttypes', >>>> 'django.contrib.sessions', >>>> 'django.contrib.messages', >>>> 'django.contrib.staticfiles', >>>> >>>> >>>> ] >>>> >>>> MIDDLEWARE = [ >>>> 'django.middleware.security.SecurityMiddleware', >>>> 'django.contrib.sessions.middleware.SessionMiddleware', >>>> 'django.middleware.common.CommonMiddleware', >>>> 'django.middleware.csrf.CsrfViewMiddleware', >>>> 'django.contrib.auth.middleware.AuthenticationMiddleware', >>>> 'django.contrib.messages.middleware.MessageMiddleware', >>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware', >>>> ] >>>> >>>> ROOT_URLCONF = 'telusko.urls' >>>> >>>> >>>> TEMPLATES = [ >>>> { >>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates', >>>> 'DIRS': [os.path.join(BASE_DIR,'templates')], >>>> 'APP_DIRS': True, >>>> 'OPTIONS': { >>>> 'context_processors': [ >>>> 'django.template.context_processors.debug', >>>>
Re: CSS not working
* Hi **yashwanth** - The Suggested one tried already in earlier, But its not working .* On Friday, October 11, 2019 at 10:28:55 PM UTC+8, yashwanth .k wrote: > > Hello, > You must make a separate directory in static folder. > in the html file try using { load staticfiles } not {load static} > > On Fri, Oct 11, 2019 at 11:59 AM yasar arafath Kajamydeen < > yasa...@gmail.com > wrote: > >> *@ Jani - Executed the given cmd, Please find the output and please >> guide me further ..* >> >> >> (mypython) C:\Users\kajamydeenya\telusko>python manage.py findstatic -v 3 >> polls/style.css >> Found 'polls/style.css' here: >> C:\Users\kajamydeenya\telusko\polls\static\polls\style.css >> Looking in the following locations: >> C:\Users\kajamydeenya\telusko\static >> C:\Users\kajamydeenya\telusko\polls\static >> >> C:\Users\kajamydeenya\telusko\mypython\lib\site-packages\django\contrib\admin\st >> >> >> >> >> *Regards,* >> *Yasar Arafath K* >> >> On Friday, October 11, 2019 at 12:30:19 PM UTC+8, Jani Tiainen wrote: >>> >>> Hi. >>> >>> You could try to diagnose issue with findstatic management command: >>> >>> ./manage.py findstatic -v 3 polls/style.css >>> >>> You should get a list of paths Django tried to look for your static file >>> (stylesheet) and of course was it found. >>> >>> >>> pe 11. lokak. 2019 klo 6.19 yasar arafath Kajamydeen >>> kirjoitti: >>> >>>> Hi All, >>>> >>>> I just added style sheet in my application but its not working , Please >>>> try to help me. >>>> >>>> >>>> Setting.py >>>> >>>> >>>> >>>> import os >>>> >>>> # Build paths inside the project like this: os.path.join(BASE_DIR, ...) >>>> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) >>>> >>>> >>>> # Quick-start development settings - unsuitable for production >>>> # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ >>>> >>>> # SECURITY WARNING: keep the secret key used in production secret! >>>> SECRET_KEY = '@$k&=42v@e7u26@0+woy#%aopsiv&55jjj$a=x2tr52f_5ipyh' >>>> >>>> # SECURITY WARNING: don't run with debug turned on in production! >>>> DEBUG = True >>>> >>>> ALLOWED_HOSTS = [] >>>> >>>> >>>> # Application definition >>>> >>>> INSTALLED_APPS = [ >>>> 'polls.apps.PollsConfig', >>>> 'django.contrib.admin', >>>> 'django.contrib.auth', >>>> 'django.contrib.contenttypes', >>>> 'django.contrib.sessions', >>>> 'django.contrib.messages', >>>> 'django.contrib.staticfiles', >>>> >>>> >>>> ] >>>> >>>> MIDDLEWARE = [ >>>> 'django.middleware.security.SecurityMiddleware', >>>> 'django.contrib.sessions.middleware.SessionMiddleware', >>>> 'django.middleware.common.CommonMiddleware', >>>> 'django.middleware.csrf.CsrfViewMiddleware', >>>> 'django.contrib.auth.middleware.AuthenticationMiddleware', >>>> 'django.contrib.messages.middleware.MessageMiddleware', >>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware', >>>> ] >>>> >>>> ROOT_URLCONF = 'telusko.urls' >>>> >>>> >>>> TEMPLATES = [ >>>> { >>>> 'BACKEND': 'django.template.backends.django.DjangoTemplates', >>>> 'DIRS': [os.path.join(BASE_DIR,'templates')], >>>> 'APP_DIRS': True, >>>> 'OPTIONS': { >>>> 'context_processors': [ >>>> 'django.template.context_processors.debug', >>>> 'django.template.context_processors.request', >>>> 'django.contrib.auth.context_processors.auth', >>>> 'django.contrib.messages.context_processors.messages', >>>> ], >>>> }, >>>> }, >>&
Re: CSS not working
*@ Jani - Executed the given cmd, Please find the output and please guide me further ..* (mypython) C:\Users\kajamydeenya\telusko>python manage.py findstatic -v 3 polls/style.css Found 'polls/style.css' here: C:\Users\kajamydeenya\telusko\polls\static\polls\style.css Looking in the following locations: C:\Users\kajamydeenya\telusko\static C:\Users\kajamydeenya\telusko\polls\static C:\Users\kajamydeenya\telusko\mypython\lib\site-packages\django\contrib\admin\st *Regards,* *Yasar Arafath K* On Friday, October 11, 2019 at 12:30:19 PM UTC+8, Jani Tiainen wrote: > > Hi. > > You could try to diagnose issue with findstatic management command: > > ./manage.py findstatic -v 3 polls/style.css > > You should get a list of paths Django tried to look for your static file > (stylesheet) and of course was it found. > > > pe 11. lokak. 2019 klo 6.19 yasar arafath Kajamydeen > kirjoitti: > >> Hi All, >> >> I just added style sheet in my application but its not working , Please >> try to help me. >> >> >> Setting.py >> >> >> >> import os >> >> # Build paths inside the project like this: os.path.join(BASE_DIR, ...) >> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) >> >> >> # Quick-start development settings - unsuitable for production >> # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ >> >> # SECURITY WARNING: keep the secret key used in production secret! >> SECRET_KEY = '@$k&=42v@e7u26@0+woy#%aopsiv&55jjj$a=x2tr52f_5ipyh' >> >> # SECURITY WARNING: don't run with debug turned on in production! >> DEBUG = True >> >> ALLOWED_HOSTS = [] >> >> >> # Application definition >> >> INSTALLED_APPS = [ >> 'polls.apps.PollsConfig', >> 'django.contrib.admin', >> 'django.contrib.auth', >> 'django.contrib.contenttypes', >> 'django.contrib.sessions', >> 'django.contrib.messages', >> 'django.contrib.staticfiles', >> >> >> ] >> >> MIDDLEWARE = [ >> 'django.middleware.security.SecurityMiddleware', >> 'django.contrib.sessions.middleware.SessionMiddleware', >> 'django.middleware.common.CommonMiddleware', >> 'django.middleware.csrf.CsrfViewMiddleware', >> 'django.contrib.auth.middleware.AuthenticationMiddleware', >> 'django.contrib.messages.middleware.MessageMiddleware', >> 'django.middleware.clickjacking.XFrameOptionsMiddleware', >> ] >> >> ROOT_URLCONF = 'telusko.urls' >> >> >> TEMPLATES = [ >> { >> 'BACKEND': 'django.template.backends.django.DjangoTemplates', >> 'DIRS': [os.path.join(BASE_DIR,'templates')], >> 'APP_DIRS': True, >> 'OPTIONS': { >> 'context_processors': [ >> 'django.template.context_processors.debug', >> 'django.template.context_processors.request', >> 'django.contrib.auth.context_processors.auth', >> 'django.contrib.messages.context_processors.messages', >> ], >> }, >> }, >> ] >> >> WSGI_APPLICATION = 'telusko.wsgi.application' >> >> >> # Database >> # https://docs.djangoproject.com/en/2.2/ref/settings/#databases >> >> DATABASES = { >> 'default': { >> 'ENGINE': 'django.db.backends.sqlite3', >> 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # Or path to database >> file if using sqlite3. >> 'USER': '', # Not used with sqlite3. >> 'PASSWORD': '', # Not used with sqlite3. >> 'HOST': '', # Set to empty string for localhost. Not used with >> sqlite3. >> 'PORT': '', >> } >> } >> >> >> # Password validation >> # >> https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators >> >> AUTH_PASSWORD_VALIDATORS = [ >> { >> 'NAME': >> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', >> }, >> { >> 'NAME': >> 'django.contrib.auth.passw
Re: CSS not working
@Suraj - Please find the polls.xlsx attachment in conversation . On Friday, October 11, 2019 at 12:10:04 PM UTC+8, Suraj Thapa FC wrote: > > Send the directory structure of the project > > On Fri, 11 Oct, 2019, 9:29 AM yasar arafath Kajamydeen, > wrote: > >> Hi Suraj, >> >> As for your suggestion i tried like this but its not working , Please do >> needful. >> >> >> >> STATIC_URL = '/static/' >> STATICFILES_DIRS = [ >> os.path.join(BASE_DIR, 'static'), >> ] >> >> >> >> >> >> >> Regards, >> Yasar Arafath K >> >> >> >> >> >> >> On Friday, October 11, 2019 at 11:18:42 AM UTC+8, yasar arafath >> Kajamydeen wrote: >>> >>> Hi All, >>> >>> I just added style sheet in my application but its not working , Please >>> try to help me. >>> >>> >>> Setting.py >>> >>> >>> >>> import os >>> >>> # Build paths inside the project like this: os.path.join(BASE_DIR, ...) >>> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) >>> >>> >>> # Quick-start development settings - unsuitable for production >>> # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ >>> >>> # SECURITY WARNING: keep the secret key used in production secret! >>> SECRET_KEY = '@$k&=42v@e7u26@0+woy#%aopsiv&55jjj$a=x2tr52f_5ipyh' >>> >>> # SECURITY WARNING: don't run with debug turned on in production! >>> DEBUG = True >>> >>> ALLOWED_HOSTS = [] >>> >>> >>> # Application definition >>> >>> INSTALLED_APPS = [ >>> 'polls.apps.PollsConfig', >>> 'django.contrib.admin', >>> 'django.contrib.auth', >>> 'django.contrib.contenttypes', >>> 'django.contrib.sessions', >>> 'django.contrib.messages', >>> 'django.contrib.staticfiles', >>> >>> >>> ] >>> >>> MIDDLEWARE = [ >>> 'django.middleware.security.SecurityMiddleware', >>> 'django.contrib.sessions.middleware.SessionMiddleware', >>> 'django.middleware.common.CommonMiddleware', >>> 'django.middleware.csrf.CsrfViewMiddleware', >>> 'django.contrib.auth.middleware.AuthenticationMiddleware', >>> 'django.contrib.messages.middleware.MessageMiddleware', >>> 'django.middleware.clickjacking.XFrameOptionsMiddleware', >>> ] >>> >>> ROOT_URLCONF = 'telusko.urls' >>> >>> >>> TEMPLATES = [ >>> { >>> 'BACKEND': 'django.template.backends.django.DjangoTemplates', >>> 'DIRS': [os.path.join(BASE_DIR,'templates')], >>> 'APP_DIRS': True, >>> 'OPTIONS': { >>> 'context_processors': [ >>> 'django.template.context_processors.debug', >>> 'django.template.context_processors.request', >>> 'django.contrib.auth.context_processors.auth', >>> 'django.contrib.messages.context_processors.messages', >>> ], >>> }, >>> }, >>> ] >>> >>> WSGI_APPLICATION = 'telusko.wsgi.application' >>> >>> >>> # Database >>> # https://docs.djangoproject.com/en/2.2/ref/settings/#databases >>> >>> DATABASES = { >>> 'default': { >>> 'ENGINE': 'django.db.backends.sqlite3', >>> 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # Or path to >>> database file if using sqlite3. >>> 'USER': '', # Not used with sqlite3. >>> 'PASSWORD': '', # Not used with sqlite3. >>> 'HOST': '', # Set to empty string for localhost. Not used with >>> sqlite3. >>> 'PORT': '', >>> } >>> } >>> >>> >>> # Password validation >>> # >>> https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators >>> >>> AUTH_PASSWORD_VALIDAT
Re: CSS not working
Hi Suraj, As for your suggestion i tried like this but its not working , Please do needful. STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] Regards, Yasar Arafath K On Friday, October 11, 2019 at 11:18:42 AM UTC+8, yasar arafath Kajamydeen wrote: > > Hi All, > > I just added style sheet in my application but its not working , Please > try to help me. > > > Setting.py > > > > import os > > # Build paths inside the project like this: os.path.join(BASE_DIR, ...) > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) > > > # Quick-start development settings - unsuitable for production > # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ > > # SECURITY WARNING: keep the secret key used in production secret! > SECRET_KEY = '@$k&=42v@e7u26@0+woy#%aopsiv&55jjj$a=x2tr52f_5ipyh' > > # SECURITY WARNING: don't run with debug turned on in production! > DEBUG = True > > ALLOWED_HOSTS = [] > > > # Application definition > > INSTALLED_APPS = [ > 'polls.apps.PollsConfig', > 'django.contrib.admin', > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.messages', > 'django.contrib.staticfiles', > > > ] > > MIDDLEWARE = [ > 'django.middleware.security.SecurityMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.common.CommonMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > 'django.middleware.clickjacking.XFrameOptionsMiddleware', > ] > > ROOT_URLCONF = 'telusko.urls' > > > TEMPLATES = [ > { > 'BACKEND': 'django.template.backends.django.DjangoTemplates', > 'DIRS': [os.path.join(BASE_DIR,'templates')], > 'APP_DIRS': True, > 'OPTIONS': { > 'context_processors': [ > 'django.template.context_processors.debug', > 'django.template.context_processors.request', > 'django.contrib.auth.context_processors.auth', > 'django.contrib.messages.context_processors.messages', > ], > }, > }, > ] > > WSGI_APPLICATION = 'telusko.wsgi.application' > > > # Database > # https://docs.djangoproject.com/en/2.2/ref/settings/#databases > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.sqlite3', > 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # Or path to database > file if using sqlite3. > 'USER': '', # Not used with sqlite3. > 'PASSWORD': '', # Not used with sqlite3. > 'HOST': '', # Set to empty string for localhost. Not used with > sqlite3. > 'PORT': '', > } > } > > > # Password validation > # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators > > AUTH_PASSWORD_VALIDATORS = [ > { > 'NAME': > 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', > }, > { > 'NAME': > 'django.contrib.auth.password_validation.MinimumLengthValidator', > }, > { > 'NAME': > 'django.contrib.auth.password_validation.CommonPasswordValidator', > }, > { > 'NAME': > 'django.contrib.auth.password_validation.NumericPasswordValidator', > }, > ] > > > # Internationalization > # https://docs.djangoproject.com/en/2.2/topics/i18n/ > > LANGUAGE_CODE = 'en-us' > > TIME_ZONE = 'UTC' > > USE_I18N = True > > USE_L10N = True > > USE_TZ = True > > > # Static files (CSS, JavaScript, Images) > # https://docs.djangoproject.com/en/2.2/howto/static-files/ > > STATIC_URL = '/static/' > STATICFILES_DIRS = [ > os.path.join(BASE_DIR, 'style.css'), > ] > > > > > > *style.css* > > > > > li a { > color: green; > } > > > > > > > > *index.html* > > > {% load static %} > > > {% if latest_question_list %} > > {% for question in latest_question_list %} > {{ > question.question_text }} > {% endfor %} > > {% else %} > No polls are available. > {% endif %} > > > > > > Regards, > > Yasar Arafath K > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bb82f38d-8e9d-4ef7-a1b9-ea3726973ff0%40googlegroups.com.
Re: CSS not working
Hi Mike, I created separate folder for static, Please find the att (polls.xlsx). Regards, Yasar Arafath K On Friday, October 11, 2019 at 11:18:42 AM UTC+8, yasar arafath Kajamydeen wrote: > > Hi All, > > I just added style sheet in my application but its not working , Please > try to help me. > > > Setting.py > > > > import os > > # Build paths inside the project like this: os.path.join(BASE_DIR, ...) > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) > > > # Quick-start development settings - unsuitable for production > # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ > > # SECURITY WARNING: keep the secret key used in production secret! > SECRET_KEY = '@$k&=42v@e7u26@0+woy#%aopsiv&55jjj$a=x2tr52f_5ipyh' > > # SECURITY WARNING: don't run with debug turned on in production! > DEBUG = True > > ALLOWED_HOSTS = [] > > > # Application definition > > INSTALLED_APPS = [ > 'polls.apps.PollsConfig', > 'django.contrib.admin', > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.messages', > 'django.contrib.staticfiles', > > > ] > > MIDDLEWARE = [ > 'django.middleware.security.SecurityMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.common.CommonMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > 'django.middleware.clickjacking.XFrameOptionsMiddleware', > ] > > ROOT_URLCONF = 'telusko.urls' > > > TEMPLATES = [ > { > 'BACKEND': 'django.template.backends.django.DjangoTemplates', > 'DIRS': [os.path.join(BASE_DIR,'templates')], > 'APP_DIRS': True, > 'OPTIONS': { > 'context_processors': [ > 'django.template.context_processors.debug', > 'django.template.context_processors.request', > 'django.contrib.auth.context_processors.auth', > 'django.contrib.messages.context_processors.messages', > ], > }, > }, > ] > > WSGI_APPLICATION = 'telusko.wsgi.application' > > > # Database > # https://docs.djangoproject.com/en/2.2/ref/settings/#databases > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.sqlite3', > 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # Or path to database > file if using sqlite3. > 'USER': '', # Not used with sqlite3. > 'PASSWORD': '', # Not used with sqlite3. > 'HOST': '', # Set to empty string for localhost. Not used with > sqlite3. > 'PORT': '', > } > } > > > # Password validation > # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators > > AUTH_PASSWORD_VALIDATORS = [ > { > 'NAME': > 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', > }, > { > 'NAME': > 'django.contrib.auth.password_validation.MinimumLengthValidator', > }, > { > 'NAME': > 'django.contrib.auth.password_validation.CommonPasswordValidator', > }, > { > 'NAME': > 'django.contrib.auth.password_validation.NumericPasswordValidator', > }, > ] > > > # Internationalization > # https://docs.djangoproject.com/en/2.2/topics/i18n/ > > LANGUAGE_CODE = 'en-us' > > TIME_ZONE = 'UTC' > > USE_I18N = True > > USE_L10N = True > > USE_TZ = True > > > # Static files (CSS, JavaScript, Images) > # https://docs.djangoproject.com/en/2.2/howto/static-files/ > > STATIC_URL = '/static/' > STATICFILES_DIRS = [ > os.path.join(BASE_DIR, 'style.css'), > ] > > > > > > *style.css* > > > > > li a { > color: green; > } > > > > > > > > *index.html* > > > {% load static %} > > > {% if latest_question_list %} > > {% for question in latest_question_list %} > {{ > question.question_text }} > {% endfor %} > > {% else %} > No polls are available. > {% endif %} > > > > > > Regards, > > Yasar Arafath K > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd8a59a9-5145-4f11-9fef-44f3132453e1%40googlegroups.com. polls.xlsx Description: MS-Excel 2007 spreadsheet
CSS not working
Hi All, I just added style sheet in my application but its not working , Please try to help me. Setting.py import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '@$k&=42v@e7u26@0+woy#%aopsiv&55jjj$a=x2tr52f_5ipyh' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'polls.apps.PollsConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'telusko.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR,'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'telusko.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', } } # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'style.css'), ] *style.css* li a { color: green; } *index.html* {% load static %} {% if latest_question_list %} {% for question in latest_question_list %} {{ question.question_text }} {% endfor %} {% else %} No polls are available. {% endif %} Regards, Yasar Arafath K -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3a71830f-e494-47b0-be2d-6d43e8d7cb27%40googlegroups.com.
Not Getting proper Result
Hi All, Page navigation not working correctly instead it showing error messge as " You didn't select a choice" . Can some one put light on this . Regards, Yasar Arafath K *My views.py* from django.shortcuts import get_object_or_404, render from django.http import Http404 from django.http import HttpResponse,HttpResponseRedirect from django.shortcuts import get_object_or_404,render from django.urls import reverse from .models import Choice,Question def index(request): latest_question_list=Question.objects.order_by('pub_date')[:3] context={'latest_question_list':latest_question_list} return render(request,'polls/index.html',context) def detail(request, question_id): question = get_object_or_404(Question, pk=question_id) return render(request, 'polls/detail.html', {'question': question}) def results(request, question_id): question = get_object_or_404(Question, pk=question_id) return render(request, 'polls/results.html', {'question': question}) def vote(request, question_id): question = get_object_or_404(Question, pk=question_id) try: selected_choice = question.choice_set.get(pk=request.POST['choice']) except (KeyError, Choice.DoesNotExist): # Redisplay the question voting form. return render(request, 'polls/detail.html', { 'question': question, 'error_message': "You didn't select a choice.", }) else: selected_choice.votes += 1 selected_choice.save() # Always return an HttpResponseRedirect after successfully dealing # with POST data. This prevents data from being posted twice if a # user hits the Back button. return HttpResponseRedirect(reverse('polls:results', args=(question.id,))) *My result.html* {{ question.question_text }} {% for choice in question.choice_set.all %} {{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }} {% endfor %} Vote again? *my urls.py* from django.urls import path from . import views app_name = 'polls' urlpatterns = [ # ex: /polls/ path('', views.index, name='index'), # ex: /polls/5/ path('/', views.detail, name='detail'), # ex: /polls/5/results/ path('/results/', views.results, name='results'), # ex: /polls/5/vote/ path('/vote/', views.vote, name='vote'), ] *my details.html* {{ question.question_text }} {% if error_message %}{{ error_message }}{% endif %} {% csrf_token %} {% for choice in question.choice_set.all %} {{ choice.choice_text }} {% endfor %} *my index.html* {% if latest_question_list %} {% for question in latest_question_list %} {{ question.question_text }} {% endfor %} {% else %} No polls are available. {% endif %} my models.py import datetime from django.db import models from django.utils import timezone # Create your models here. class Question(models.Model): question_text=models.CharField(max_length=200) pub_date=models.DateTimeField('date published') def __str__(self): return self.question_text def was_published_recently(self): return self.pub_date >= timezone.now() - datetime.timedelta(days=1) class Choice(models.Model): question =models.ForeignKey(Question,on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1ac49553-00d2-42a7-9657-36efc9e8470a%40googlegroups.com.
AttributeError
Hi , While try to execute it showing AttributeError, Can some one help me on this. *My views.py* from django.shortcuts import render from django.http import Http404 from django.http import HttpResponse from .models import Question def index(request): latest_question_list=Question.objects.order_by('pub_date')[:3] context={'latest_question_list':latest_question_list} return render(request,'polls/index.html',context) def detail(request, question_id): try: question=Question.object.get(pk=question_id) except Question.DoesNotExist: raise Http404("Question does not exist") return render(request, 'polls/detail.html', {'question':question}) def results(request, question_id): response = "You're looking at the results of question %s." return HttpResponse(response%question_id) def vote(request, question_id): return HttpResponse("You're voting on question %s."%question_id) *My detail.html* {{question}} *My polls/urls.py* from django.urls import path from . import views urlpatterns = [ # ex: /polls/ path('', views.index, name='index'), # ex: /polls/5/ path('/', views.detail, name='detail'), # ex: /polls/5/results/ path('/results/', views.results, name='results'), # ex: /polls/5/vote/ path('/vote/', views.vote, name='vote'), ] -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9918df61-41fd-40bd-8ca3-79ee3be12ec3%40googlegroups.com.
Virtual Environment error
Dear All, Actually i forget my virtual environment name. So when i run -- python manage.py runserver command its showing error like this . ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? Thanks in Advance. Regards, Yasar Arafath K -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/198d3480-4f3b-4cf3-971d-ce6c7ec19080%40googlegroups.com.
Re: use of migrate command and how to see the tables
Thanks all who is replied to my post On Fri, Jul 19, 2019 at 10:32 PM Afotro Ben wrote: > > in my opinion migrate is the command that saves your code for django to > run or tells django that an application has been installed. > > > On Friday, 19 July 2019 08:22:33 UTC, yasar arafath Kajamydeen wrote: >> >> Hi all, >> >> can some one tell me what is the use of migrate command ? >> >> when i enter the command i got the following error (No migration to >> apply) . I dont know what to do further and also i would like to create >> tables (sqlite) . >> >> >> [image: migrate.JPG] >> >> >> Note - I am a beginer to Django .. Most welcome with your reply >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/a73a1099-770e-49af-b8f1-767adae224ba%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/a73a1099-770e-49af-b8f1-767adae224ba%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADVPYNz2MHO2L0zacky4L%3DtT%3DsMLgNVLD-XB3s%3Dc8SD%3DKVnFsw%40mail.gmail.com.
Re: use of migrate command and how to see the tables
Hi Jani, Thanks for the reply. Please try to solve the error which i shared (screen shot ). Regards, Yasar Arafath K On Friday, July 19, 2019 at 4:33:08 PM UTC+8, Jani Tiainen wrote: > > Hi. > > Migrate command applies migrations, changes to your models, into database. > > For example if you add a new field in your model you need to create a > migration (piece of code that reflects your change) using makemigrations > command. > > Once you have made migration(s) you need to apply them so database > contains a colum in a table that your model represents. > > > pe 19. heinäk. 2019 klo 11.23 yasar arafath Kajamydeen > kirjoitti: > >> Hi all, >> >> can some one tell me what is the use of migrate command ? >> >> when i enter the command i got the following error (No migration to >> apply) . I dont know what to do further and also i would like to create >> tables (sqlite) . >> >> >> [image: migrate.JPG] >> >> >> Note - I am a beginer to Django .. Most welcome with your reply >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django...@googlegroups.com . >> To post to this group, send email to django...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/e715d8b3-9ed7-433d-9bf2-94899b196289%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/e715d8b3-9ed7-433d-9bf2-94899b196289%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7493ad80-8e0a-474b-84f0-a4f0e9803457%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
use of migrate command and how to see the tables
Hi all, can some one tell me what is the use of migrate command ? when i enter the command i got the following error (No migration to apply) . I dont know what to do further and also i would like to create tables (sqlite) . [image: migrate.JPG] Note - I am a beginer to Django .. Most welcome with your reply -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e715d8b3-9ed7-433d-9bf2-94899b196289%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
how to see the list of created tables in sqlite
Hi all, After executing the command - python manage.py migrate the command is successful and then i would like to see the list of created tables so i enter command like .schema but it showing error. Please try to help me . Note - Am beginer to python -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a1debe04-7ff1-48bc-b733-ed9500e2593a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.