Hi Friends today i have tried to create a simple cms using django :
Use the terminal
I have created a project with a name cms with command : django-admin.py cms
Then I have changed the permission of the settings file with command : chmod a+w settings.py
Then edit the settings file using a text editor and change : -
engine : sqlite3
name : (the destination) eg home/usr/cms/cms.db
(the cms.db is the name given by us so sqlite would automatically create a file with that name)
And also change the Time Zone : default given is America/Chicago (Check this link for any other information : www.djangoproject.com/documentation/settings/
)
Now create the database file using the command : python manage.py syncdb
Now the database file will be created.
Now again edit the settings.py file and add two : python modules
django.contrib.flatpages and django.contrib.admin
Once we have added those again save and execute the command : python manage.py syncdb
Now that command would create corresponding tables .
Then edit the urls.py file Where you have a statement (# Uncomment the next two lines to enable the admin:) uncomment it and also this (url(r'^admin/', include(admin.site.urls)))
Now save it and then run the server using: python manage.py runserver
Which will create a login page . Enter the username and password given while syncdb .
Now you will get a webpage like this :
And here then you could edit the sites link . And change the display name as localhost and the display domain as 127.0.0.1:8000 now save
And then click the flatpages link and change urls as /firstpage/ and give title and content whatever you like.
Now create a folder named flatpage in cms directory. And inside it create a file called default.html
And then open the settings folder and change the directory as home/usr/cms/ and save it .
And then start the server and run the url 127.0.0.1:8000/first-page.
Now the content you have entered in the flat page appears at your browser by which we have created a simple cms in django
Use the terminal
I have created a project with a name cms with command : django-admin.py cms
Then I have changed the permission of the settings file with command : chmod a+w settings.py
Then edit the settings file using a text editor and change : -
engine : sqlite3
name : (the destination) eg home/usr/cms/cms.db
(the cms.db is the name given by us so sqlite would automatically create a file with that name)
And also change the Time Zone : default given is America/Chicago (Check this link for any other information : www.djangoproject.com/documentation/settings/
)
Now create the database file using the command : python manage.py syncdb
Now the database file will be created.
Now again edit the settings.py file and add two : python modules
django.contrib.flatpages and django.contrib.admin
Once we have added those again save and execute the command : python manage.py syncdb
Now that command would create corresponding tables .
Then edit the urls.py file Where you have a statement (# Uncomment the next two lines to enable the admin:) uncomment it and also this (url(r'^admin/', include(admin.site.urls)))
Now save it and then run the server using: python manage.py runserver
Which will create a login page . Enter the username and password given while syncdb .
Now you will get a webpage like this :
And here then you could edit the sites link . And change the display name as localhost and the display domain as 127.0.0.1:8000 now save
And then click the flatpages link and change urls as /firstpage/ and give title and content whatever you like.
Now create a folder named flatpage in cms directory. And inside it create a file called default.html
And then open the settings folder and change the directory as home/usr/cms/ and save it .
And then start the server and run the url 127.0.0.1:8000/first-page.
Now the content you have entered in the flat page appears at your browser by which we have created a simple cms in django
No comments:
Post a Comment