Hi guys,
I have a drop-down menu “velo” in which I have four categories “Urbain”, “VTT” …
And I do not find how to pass value to “velo” as in my categories.
.html
<li class="active"><a href="{% url 'index' %}">Accueil</a></li>
<li><form name="velo" action="{% url 'shop' %}" method="get" accept-charset="utf-8">
<input type="hidden" name="velo" value="velo"><a href="{% url 'shop' %}">Velo</a></form>
<ul class="dropdown">
<li><a href="{% url 'shop' %}">URBAIN</a></li>
<li><a href="{% url 'shop' %}">ROUTE</a></li>
<li><a href="{% url 'shop' %}" name="VTT">VTT</a></li>
<li><a href="{% url 'shop' %}">TREKKING</a></li>
<li><a href="{% url 'shop' %}">SPEED BIKE</a></li>
<li><a href="{% url 'shop' %}">PLIABLE</a></li>
</ul>
</li>
I have a second problem from an another project, I get an error 500 but I don’t know why … (deploy:heroku)
logs Heroku:
> 2020-03-25T15:22:03.790094+00:00 app[web.1]: [2020-03-25 15:22:03 +0000] [10] [INFO] Booting worker with pid: 10
> 2020-03-25T15:22:03.827668+00:00 app[web.1]: [2020-03-25 15:22:03 +0000] [11] [INFO] Booting worker with pid: 11
> 2020-03-25T15:22:10.317327+00:00 app[api]: Starting process with command `python app/manage.py migrate` by user yoh
> 2020-03-25T15:22:16.517827+00:00 heroku[run.1968]: State changed from starting to up
> 2020-03-25T15:22:16.614346+00:00 heroku[run.1968]: Awaiting client
> 2020-03-25T15:22:16.664513+00:00 heroku[run.1968]: Starting process with command `python app/manage.py migrate`
> 2020-03-25T15:22:22.092036+00:00 heroku[run.1968]: State changed from up to complete
> 2020-03-25T15:22:22.067686+00:00 heroku[run.1968]: Process exited with status 0
> 2020-03-25T15:22:50.181925+00:00 app[api]: Starting process with command `python app/manage.py createsuperuser` by user yoh
> 2020-03-25T15:22:57.282925+00:00 heroku[run.8388]: State changed from starting to up
> 2020-03-25T15:22:57.690011+00:00 heroku[run.8388]: Awaiting client
> 2020-03-25T15:22:57.723756+00:00 heroku[run.8388]: Starting process with command `python app/manage.py createsuperuser`
> 2020-03-25T15:23:20.219825+00:00 heroku[run.8388]: State changed from up to complete
> 2020-03-25T15:23:20.188548+00:00 heroku[run.8388]: Process exited with status 0
> 2020-03-25T15:24:14.393961+00:00 heroku[router]: at=info method=GET path="/" host=purbeurreapp.herokuapp.com request_id=d049d459-71b3-46ed-b07a-a9c4172979b6 fwd="109.13.3.168" dyno=web.1 connect=0ms service=123ms status=500 bytes=419 protocol=https
> 2020-03-25T15:24:14.394296+00:00 app[web.1]: 10.97.210.61 - - [25/Mar/2020:15:24:14 +0000] "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15"
> 2020-03-25T15:35:26.929117+00:00 app[api]: Starting process with command `python app/manage.py loaddata app/dump/data.json` by user yoh
> 2020-03-25T15:35:34.186304+00:00 heroku[run.1812]: State changed from starting to up
> 2020-03-25T15:35:34.451945+00:00 heroku[run.1812]: Awaiting client
> 2020-03-25T15:35:34.478479+00:00 heroku[run.1812]: Starting process with command `python app/manage.py loaddata app/dump/data.json`
> 2020-03-25T15:35:39.776206+00:00 heroku[run.1812]: State changed from up to complete
> 2020-03-25T15:35:39.749798+00:00 heroku[run.1812]: Process exited with status 1
> 2020-03-25T15:42:00.000000+00:00 app[api]: Build started by user yoh
> 2020-03-25T15:42:50.557952+00:00 heroku[web.1]: Restarting
> 2020-03-25T15:42:50.562248+00:00 heroku[web.1]: State changed from up to starting
> 2020-03-25T15:42:50.284057+00:00 app[api]: Deploy 5312a799 by user yoh
> 2020-03-25T15:42:50.284057+00:00 app[api]: Release v11 created by user yoh
> 2020-03-25T15:42:52.182924+00:00 heroku[web.1]: Stopping all processes with SIGTERM
> 2020-03-25T15:42:52.200735+00:00 app[web.1]: [2020-03-25 15:42:52 +0000] [4] [INFO] Handling signal: term
> 2020-03-25T15:42:52.202073+00:00 app[web.1]: [2020-03-25 15:42:52 +0000] [11] [INFO] Worker exiting (pid: 11)
> 2020-03-25T15:42:52.202082+00:00 app[web.1]: [2020-03-25 15:42:52 +0000] [10] [INFO] Worker exiting (pid: 10)
> 2020-03-25T15:42:52.303863+00:00 app[web.1]: [2020-03-25 15:42:52 +0000] [4] [INFO] Shutting down: Master
> 2020-03-25T15:42:52.380966+00:00 heroku[web.1]: Process exited with status 0
> 2020-03-25T15:42:57.064600+00:00 heroku[web.1]: Starting process with command `gunicorn app.wsgi --chdir app/`
> 2020-03-25T15:42:59.000000+00:00 app[api]: Build succeeded
> 2020-03-25T15:43:00.108947+00:00 heroku[web.1]: State changed from starting to up
> 2020-03-25T15:42:59.739653+00:00 app[web.1]: [2020-03-25 15:42:59 +0000] [4] [INFO] Starting gunicorn 20.0.4
> 2020-03-25T15:42:59.740310+00:00 app[web.1]: [2020-03-25 15:42:59 +0000] [4] [INFO] Listening at: [http://0.0.0.0:20853](http://0.0.0.0:20853/) (4)
> 2020-03-25T15:42:59.740443+00:00 app[web.1]: [2020-03-25 15:42:59 +0000] [4] [INFO] Using worker: sync
> 2020-03-25T15:42:59.744924+00:00 app[web.1]: [2020-03-25 15:42:59 +0000] [10] [INFO] Booting worker with pid: 10
> 2020-03-25T15:42:59.796719+00:00 app[web.1]: [2020-03-25 15:42:59 +0000] [11] [INFO] Booting worker with pid: 11
> 2020-03-25T15:43:50.272695+00:00 app[api]: Starting process with command `python app/manage.py loaddata app/dump/data.json` by user yoh
> 2020-03-25T15:43:57.198824+00:00 heroku[run.7767]: State changed from starting to up
> 2020-03-25T15:43:57.276373+00:00 heroku[run.7767]: Awaiting client
> 2020-03-25T15:43:57.299022+00:00 heroku[run.7767]: Starting process with command `python app/manage.py loaddata app/dump/data.json`
> 2020-03-25T15:44:02.340550+00:00 heroku[run.7767]: State changed from up to complete
> 2020-03-25T15:44:02.322943+00:00 heroku[run.7767]: Process exited with status 1
> 2020-03-25T15:47:53.890742+00:00 app[api]: Starting process with command `python app/manage.py loaddata app/app/dump/data.json` by user yoh
> 2020-03-25T15:48:03.446819+00:00 heroku[run.1889]: State changed from starting to up
> 2020-03-25T15:48:03.829539+00:00 heroku[run.1889]: Awaiting client
> 2020-03-25T15:48:03.880371+00:00 heroku[run.1889]: Starting process with command `python app/manage.py loaddata app/app/dump/data.json`
> 2020-03-25T15:48:26.379240+00:00 heroku[run.1889]: State changed from up to complete
> 2020-03-25T15:48:26.365137+00:00 heroku[run.1889]: Process exited with status 0
> 2020-03-25T15:49:52.443614+00:00 heroku[router]: at=info method=GET path="/" host=purbeurreapp.herokuapp.com request_id=cdce28ab-ce2c-4ff4-8be9-ab182891de1f fwd="109.13.3.168" dyno=web.1 connect=0ms service=99ms status=500 bytes=419 protocol=https
> 2020-03-25T15:49:52.443984+00:00 app[web.1]: 10.63.103.37 - - [25/Mar/2020:15:49:52 +0000] "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15"
> 2020-03-25T15:56:59.000000+00:00 app[api]: Build started by user yoh
> 2020-03-25T15:57:51.807247+00:00 app[api]: Release v12 created by user yoh
> 2020-03-25T15:57:51.807247+00:00 app[api]: Deploy 597746d5 by user yoh
> 2020-03-25T15:57:52.067320+00:00 heroku[web.1]: Restarting
> 2020-03-25T15:57:52.085557+00:00 heroku[web.1]: State changed from up to starting
> 2020-03-25T15:57:53.395862+00:00 heroku[web.1]: Stopping all processes with SIGTERM
> 2020-03-25T15:57:53.409326+00:00 app[web.1]: [2020-03-25 15:57:53 +0000] [10] [INFO] Worker exiting (pid: 10)
> 2020-03-25T15:57:53.409334+00:00 app[web.1]: [2020-03-25 15:57:53 +0000] [11] [INFO] Worker exiting (pid: 11)
> 2020-03-25T15:57:53.420157+00:00 app[web.1]: [2020-03-25 15:57:53 +0000] [4] [INFO] Handling signal: term
> 2020-03-25T15:57:53.522249+00:00 app[web.1]: [2020-03-25 15:57:53 +0000] [4] [INFO] Shutting down: Master
> 2020-03-25T15:57:53.620020+00:00 heroku[web.1]: Process exited with status 0
> 2020-03-25T15:58:00.473703+00:00 heroku[web.1]: Starting process with command `gunicorn app.wsgi --chdir app/`
> 2020-03-25T15:58:00.000000+00:00 app[api]: Build succeeded
> 2020-03-25T15:58:03.421135+00:00 app[web.1]: [2020-03-25 15:58:03 +0000] [4] [INFO] Starting gunicorn 20.0.4
> 2020-03-25T15:58:03.421913+00:00 app[web.1]: [2020-03-25 15:58:03 +0000] [4] [INFO] Listening at: [http://0.0.0.0:26163](http://0.0.0.0:26163/) (4)
> 2020-03-25T15:58:03.422039+00:00 app[web.1]: [2020-03-25 15:58:03 +0000] [4] [INFO] Using worker: sync
> 2020-03-25T15:58:03.427953+00:00 app[web.1]: [2020-03-25 15:58:03 +0000] [10] [INFO] Booting worker with pid: 10
> 2020-03-25T15:58:03.514257+00:00 app[web.1]: [2020-03-25 15:58:03 +0000] [11] [INFO] Booting worker with pid: 11
> 2020-03-25T15:58:04.808452+00:00 heroku[web.1]: State changed from starting to up
> 2020-03-25T15:58:24.849765+00:00 heroku[router]: at=info method=GET path="/" host=purbeurreapp.herokuapp.com request_id=324070bb-53e6-4944-9ab3-11b70debf391 fwd="109.13.3.168" dyno=web.1 connect=1ms service=96ms status=500 bytes=419 protocol=https
> 2020-03-25T15:58:24.847013+00:00 app[web.1]: 10.155.219.74 - - [25/Mar/2020:15:58:24 +0000] "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15"
settings.py
import os
import django_heroku
# 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/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '****'
# SECURITY WARNING: don't run with debug turned on in production!
if os.environ.get('ENV') == 'PRODUCTION':
DEBUG = False
# Static files settings
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
else:
DEBUG = True
ALLOWED_HOSTS = ["purbeurreapp.herokuapp.com/"]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'off.apps.OffConfig',
'user.apps.UserConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'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',
'django.middleware.locale.LocaleMiddleware',
]
ROOT_URLCONF = 'app.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
],
},
},
]
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
},
},
}
WSGI_APPLICATION = 'nutella.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '****',
'USER': '****',
'PASSWORD': '****',
'HOST': 'localhost',
'PORT': '',
'CONN_MAX_AGE': 500,
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/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/3.0/topics/i18n/
LANGUAGE_CODE = 'fr'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'app/static')
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
os.path.join(PROJECT_ROOT, 'user/static'),
)
STATIC_URL = '/static/'
LOGIN_REDIRECT_URL = 'compte'
LOGIN_URL = 'login'
django_heroku.settings(locals())
thank you in advance for your help