Best Python code snippet using SeleniumBase
settings.py
Source:settings.py
1"""2Django settings for test_tinymce project.3Generated by 'django-admin startproject' using Django 1.9.2.4For more information on this file, see5https://docs.djangoproject.com/en/1.9/topics/settings/6For the full list of settings and their values, see7https://docs.djangoproject.com/en/1.9/ref/settings/8"""9import os10from django import VERSION11# Build paths inside the project like this: os.path.join(BASE_DIR, ...)12BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))13# Quick-start development settings - unsuitable for production14# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/15# SECURITY WARNING: keep the secret key used in production secret!16SECRET_KEY = 'FooBar'17# SECURITY WARNING: don't run with debug turned on in production!18DEBUG = True19ALLOWED_HOSTS = []20# Application definition21INSTALLED_APPS = [22 'tinymce',23 'django.contrib.admin',24 'django.contrib.auth',25 'django.contrib.contenttypes',26 'django.contrib.sessions',27 'django.contrib.messages',28 'django.contrib.staticfiles',29 'django.contrib.sites',30 # To use filebrowser you must create "uploads" folder within your "media" folder31 # 'filebrowser',32 'test_tinymce',33]34MIDDLEWARE_CLASSES = [35 'django.contrib.sessions.middleware.SessionMiddleware',36 'django.middleware.common.CommonMiddleware',37 'django.middleware.csrf.CsrfViewMiddleware',38 'django.contrib.auth.middleware.AuthenticationMiddleware',39 'django.contrib.messages.middleware.MessageMiddleware',40 'django.middleware.clickjacking.XFrameOptionsMiddleware',41]42MIDDLEWARE = MIDDLEWARE_CLASSES43ROOT_URLCONF = 'test_tinymce.urls'44TEMPLATES = [45 {46 'BACKEND': 'django.template.backends.django.DjangoTemplates',47 'DIRS': [],48 'APP_DIRS': True,49 'OPTIONS': {50 'context_processors': [51 'django.template.context_processors.debug',52 'django.template.context_processors.request',53 'django.contrib.auth.context_processors.auth',54 'django.contrib.messages.context_processors.messages',55 ],56 },57 },58]59WSGI_APPLICATION = 'test_tinymce.wsgi.application'60# Database61# https://docs.djangoproject.com/en/1.9/ref/settings/#databases62DATABASES = {63 'default': {64 'ENGINE': 'django.db.backends.sqlite3',65 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),66 }67}68# Internationalization69# https://docs.djangoproject.com/en/1.9/topics/i18n/70LANGUAGES = [71 ('en-us', 'English (US)'),72]73LANGUAGE_CODE = 'en-us'74TIME_ZONE = 'UTC'75USE_I18N = True76USE_L10N = True77USE_TZ = True78SITE_ID = 179# Static files (CSS, JavaScript, Images)80# https://docs.djangoproject.com/en/1.9/howto/static-files/81STATIC_URL = '/static/'82STATIC_ROOT = os.path.join(BASE_DIR, 'static')83MEDIA_URL = '/media/'84MEDIA_ROOT = os.path.join(BASE_DIR, 'media')...
views.py
Source:views.py
1from django.views.generic import CreateView, DetailView2from .models import TestModel3class TestCreateView(CreateView):4 template_name = 'test_tinymce/create.html'5 fields = ('content',)6 model = TestModel7class TestDisplayView(DetailView):8 template_name = 'test_tinymce/display.html'9 context_object_name = 'test_model'...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!