# Creating a project

If this is your first time using Django, you’ll have to take care of some initial setup. Namely, you’ll need to auto-generate some code that establishes a Django [<span class="xref std std-term">project</span>](https://docs.djangoproject.com/en/4.1/glossary/#term-project) – a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings.

From the command line, `<span class="pre">cd</span>` into a directory where you’d like to store your code, then run the following command:

<div class="console-block" id="bkmrk-%24-django-admin-start"><section class="c-content-unix" id="bkmrk-%24-django-admin-start-0">```
$ django-admin startproject mysite
```

</section></div>This will create a `<span class="pre">mysite</span>` directory in your current directory. If it didn’t work, see [<span class="std std-ref">Problems running django-admin</span>](https://docs.djangoproject.com/en/4.1/faq/troubleshooting/#troubleshooting-django-admin).

> Note
> 
> You’ll need to avoid naming projects after built-in Python or Django components. In particular, this means you should avoid using names like `<span class="pre">django</span>` (which will conflict with Django itself) or `<span class="pre">test</span>` (which conflicts with a built-in Python package).

> Where should this code live?
> 
> If your background is in plain old PHP (with no use of modern frameworks), you’re probably used to putting code under the web server’s document root (in a place such as `<span class="pre">/var/www</span>`). With Django, you don’t do that. It’s not a good idea to put any of this Python code within your web server’s document root, because it risks the possibility that people may be able to view your code over the web. That’s not good for security.
> 
> Put your code in some directory **outside** of the document root, such as `<span class="pre">/home/mycode</span>`.

Let’s look at what [`<span class="pre">startproject</span>`](https://docs.djangoproject.com/en/4.1/ref/django-admin/#django-admin-startproject) created:

```
mysite/
    manage.py
    mysite/
        __init__.py
        settings.py
        urls.py
        asgi.py
        wsgi.py
```

These files are:

<div class="section" id="bkmrk-the-outer%C2%A0mysite%2F%C2%A0ro">- The outer `<span class="pre">mysite/</span>` root directory is a container for your project. Its name doesn’t matter to Django; you can rename it to anything you like.
- `<span class="pre">manage.py</span>`: A command-line utility that lets you interact with this Django project in various ways. You can read all the details about `<span class="pre">manage.py</span>` in [<span class="doc">django-admin and manage.py</span>](https://docs.djangoproject.com/en/4.1/ref/django-admin/).
- The inner `<span class="pre">mysite/</span>` directory is the actual Python package for your project. Its name is the Python package name you’ll need to use to import anything inside it (e.g. `<span class="pre">mysite.urls</span>`).
- `<span class="pre">mysite/__init__.py</span>`: An empty file that tells Python that this directory should be considered a Python package. If you’re a Python beginner, read [<span class="xref std std-ref">more about packages</span>](https://docs.python.org/3/tutorial/modules.html#tut-packages "(in Python v3.11)") in the official Python docs.
- `<span class="pre">mysite/settings.py</span>`: Settings/configuration for this Django project. [<span class="doc">Django settings</span>](https://docs.djangoproject.com/en/4.1/topics/settings/) will tell you all about how settings work.
- `<span class="pre">mysite/urls.py</span>`: The URL declarations for this Django project; a “table of contents” of your Django-powered site. You can read more about URLs in [<span class="doc">URL dispatcher</span>](https://docs.djangoproject.com/en/4.1/topics/http/urls/).
- `<span class="pre">mysite/asgi.py</span>`: An entry-point for ASGI-compatible web servers to serve your project. See [<span class="doc">How to deploy with ASGI</span>](https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/) for more details.
- `<span class="pre">mysite/wsgi.py</span>`: An entry-point for WSGI-compatible web servers to serve your project. See [<span class="doc">How to deploy with WSGI</span>](https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/) for more details.

</div><div class="section" id="bkmrk-"><div class="section"><span id="bkmrk--0"></span></div></div>