CS50x threads to aide as a supplementary resource › Forums › Web Development › HarvardX: CS50W – CS50’s Web Programming with Python and JavaScript › CS50W – Lecture 3 – Django › How to start the CS50W Wiki project
- This topic is empty.
-
AuthorPosts
-
August 4, 2024 at 5:07 am #3170
Source: Generated taking help of AI tool
To start the CS50W Wiki project after uploading the distribution code and installing Django, follow these steps:
- Set Up the Project Environment:
Ensure you have the distribution code and Django installed. You can do this by running:
pip install -r requirements.txt
- Navigate to the Project Directory:
Change into the directory where your project’s main files are located. This is typically wheremanage.py
is located. For example:
cd wiki
- Start the Django Development Server:
Use the Djangomanage.py
script to start the development server. Run:
python manage.py runserver
- Access the Application:
Open a web browser and navigate to `http://127.0.0.1:8000` to see your Django project running.
Naming the Project
In Django projects, the name of the project can be determined by the name of the main directory containing the
manage.py
file. However, the internal project name is defined in the settings and structure of the Django project itself.- Project Directory: This is the top-level directory containing
manage.py
and other project-related files. The name of this directory can be anything you choose. - Django Application: Inside the project directory, there are one or more Django applications. Each application is a Python package, typically containing files like
models.py
,views.py
, andurls.py
. The application name is usually defined by the directory name containing these files.
Example Directory Structure
Here’s an example of what your directory structure might look like:
wiki/ manage.py wiki/ __init__.py settings.py urls.py wsgi.py encyclopedia/ __init__.py admin.py apps.py models.py tests.py views.py urls.py templates/ ... static/ ...
wiki/
: The project directory (name can be anything).manage.py
: Script for managing the project.wiki/
: Inner directory (actual Django project).encyclopedia/
: A Django application within the project.
Summary
- Install Django and other dependencies using
pip install -r requirements.txt
. - Navigate to the project directory (
cd wiki
). - Run the server using
python manage.py runserver
. - Open the browser to `http://127.0.0.1:8000`.
The name of the project is flexible and can be defined by how you structure your directories, but it’s typically defined by the directory containing the
manage.py
file and the internal settings of your Django project. - Set Up the Project Environment:
-
AuthorPosts
- You must be logged in to reply to this topic.