![]() Import the Django project into P圜harm community edition, you can read article How To Import Existing Django Project And Enable Django Support In P圜harm.Create Django application in command line, you can read article How To Create / Remove Django Project Application.Create Django project in command line, you can read article How To Make A Website With Python And Django.Install Django in a virtual environment, you can read article How To Install Python Django In Virtual Environment.If you are familiar with P圜harm community edition, and you want to create Django project in it, you can follow below steps. Create Django Project In P圜harm Community Edition. When the application startup, input url in the web browser, then you will get below web page.ĥ.Select DjangoHelloWorld menu item in the popup menu list to run the Django project.Click Run -> Run ( or Run -> Debug )menu item in P圜harm top tool bar to run it.You need to follow below steps to run or debug it. Now all the source code has been created. Create index.html in DjangoHelloWorld / templates folder and add the below code in it.# index_file_path = PROJECT_PATH + '/pages/home.html' # Get the index template file absolute path. ![]() # This function will return and render the home page when url is def index_page(request): This view function will return an Html template file index.html back to the client browser from django.shortcuts import render Add index_page view function in DjangoHelloWorld / my_hello_world / views.py file.Path('', views.index_page, name='index'), # When user request home page it will invoke the home function defined in views.py. Create urls.py file in DjangoHelloWorld / my_hello_world folder and add below Python code in it.Path('index/', include('my_hello_world.urls')) # when client request, the project will find the mapped process method in my_hello_world app's urls.py file. Edit DjangoHelloWorld / DjangoHelloWorld / urls.py file and add a new URL pattern.Edit DjangoHelloWorld / DjangoHelloWorld / settings.py file and add my_hello_world app at the end of INSTALLED_APPS section.Then input Django command startapp my_hello_world in the bottom console window and click enter key, you will find the my_hello_world application has been created in the project files list.ģ.Click Tools -> Run manage.py Tasks… menu item to open the python command window at bottom of P圜harm.Create Django Application my_hello_world.Īs you know, one Django project can contain multiple Django applications, now we will run $ python manage.py startapp my_hello_world command in P圜harm to create the my_hello_world application. Now you should not see it because it has not been created.Ģ. Below Django project files list contains a Django application my_hello_world which will be created later. Now you will find the Django project has been created successfully in the project explorer panel.Then select Django menu item in left navigation menu list, and select the Django project target directory in right panel, and then click Create button.Open P圜harm, click File -> New Project menu item in the top toolbar.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |