Today I test the last version of python version 3.11.0a7 with the Django-hypergen example.
The install process can be found on the GitHub page project.
You can see the full tutorial here.
tutorials, tips, tricks, commands, programming, linux, windows, database, sql, python, programming language, Fedora, drawing, painting, tutorial, tutorials
[mythcat@desk django]$ source bin/activate
I install this python module named django-tinymce:(django) [mythcat@desk django]$ pip install django-tinymce4-lite
Collecting django-tinymce4-lite
...
Installing collected packages: jsmin, django-tinymce4-lite
Successfully installed django-tinymce4-lite-1.7.2 jsmin-2.2.2
Let's see my folder project django named src:(django) [mythcat@desk django]$ cd src/
(django) [mythcat@desk src]$ ll
total 136
-rw-r--r--. 1 mythcat mythcat 135168 Sep 28 12:21 db.sqlite3
-rwxrwxr-x. 1 mythcat mythcat 541 Sep 23 18:56 manage.py
drwxrwxr-x. 4 mythcat mythcat 142 Sep 26 21:45 pages
drwxrwxr-x. 4 mythcat mythcat 142 Sep 28 18:30 products
drwxrwxr-x. 3 mythcat mythcat 112 Sep 28 12:04 templates
drwxrwxr-x. 3 mythcat mythcat 93 Sep 28 12:14 trydjango
The installation is simple and star with to your settings.py and url.py file:(django) [mythcat@desk src]$ cd trydjango/
(django) [mythcat@desk trydjango]$ vim settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'products',
'tinymce',
]
(django) [mythcat@desk trydjango]$ vim urls.py
from django.contrib import admin
from django.urls import path, include
from pages.views import home_view, about_view, contact_view
from products.views import product_detail_view
urlpatterns = [
path('', home_view, name='home'),
path('about/', about_view),
path('contact/',contact_view),
path('admin/',admin.site.urls),
path('product/',product_detail_view),
path(r'^tinymce/', include('tinymce.urls')),
This is my change I used to add the tinymce editor into my django application named products.(django) [mythcat@desk products]$ vim models.py
from django.db import models
from tinymce.models import HTMLField
# Create your models here.
class Product(models.Model):
title = models.CharField(max_length=120)
# description = models.TextField(blank=True, null=True)
description = HTMLField()
price = models.DecimalField(decimal_places=2, max_digits=1000)
summary = models.TextField(default='this is cool!')
You can see I used HTMLField and default come is TextField.$ mkdir django_001
$ cd django_001
The next step is to create and activate the virtual environment for python language and your project.
$ python3 -m venv django_001_venv
$ source django_001_venv/bin/activate
Into this virtual environment named django_001_venv you will install django web framework.
pip install django
If you have problems with update pip then update this tool.
Now start the django project named django_test.
$ django-admin startproject django_test
$ cd django_test
$ python3 manage.py runserver
Open the url http://127.0.0.1:8000/ with your web browser.$ python manage.py startapp django_blog
This make a folder named django_blog into the main django_test folder.
Into the main django_test folder you have another django_test folder with settings.py file.
Add into settings.py file the django_blog application.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_blog',
]
Let's fix some issues about admin and the django_blog application.$ python3 manage.py migrate
$ python3 manage.py createsuperuser