How To Create A Django Project In Anaconda Very Easily

Let’s see how we can create a Django project when you are using Anaconda as your default Python. We do this process by creating a new environment.  

Anaconda is a free and open-source distribution of the Python programming language for scientific computing, that helps to simplify package management and deployment.  

I highly recommend you to use Anaconda for your Python projects, if you are not using it already. Anaconda software makes life very easy.  

I have been doing projects in Django for a while. A few weeks ago, I installed Anaconda for machine learning studies and made it my default Python.  

Then I was back to doing my Django projects but my CMD was not able to run Django using the commands that I have been used previously.  

To solve these issues, I researched over the Internet a lot, but could not find the right solution either from YouTube and Google.  

Finally, I’ve got the solution after trying various things. So if you are dealing with such a situation, this article may help you.

If you are using a Windows operating system, follow along with this tutorial. I think the procedure is very similar in Mac and Linux too. So, you can follow along with this article even if you are not using Windows.  

How to Create a Django Project in Anaconda Very Easily

How To Create A Django Project In Anaconda?

Here are the steps that you need to follow to create a Django project in anaconda:

1. Create a new environment

First of all, you need to create a separate environment for Django development.  

By default, anaconda comes up with the base environment. But creating a separate environment will be helpful to manage the projects without any package dependency confliction.   

So, let’s create a separate environment specifically for web development projects using the Django framework.  

Open your CMD or Anaconda Prompt and create a separate environment called djangoenv by typing in the following command.

 conda create -n djangoenv python=3.6 anaconda    

I just mentioned the version of Python that I’m using as Python 3.6. If you want to use other versions of Python, you can do so.  

The previous command may take some time to finish its execution. Once it is done, let’s go to the next step.

2. Activate the new environment

Activate the newly created environment by typing in the following command.

 conda activate djangoenv

Now, we are inside the newly created environment. But our environment does not have Django in it. So, let’s install it.

3. Install Django in the new environment

Let’s install Django in the new environment using the following command. 

 conda install -c anaconda django 

Wait till the installation completes. It may take some time to finish. That’s it. Now you can create Django projects in this separate environment.  

Let’s try to create a sample project to check whether everything is ready. Let’s do this using the following commands.  

4. Create a new Django project

First of all, let’s start a new project called website.

 django-admin startproject website 

5. Run the Django server

Now, navigate to the project folder by using the cd command. Let’s run the project and see whether everything is working fine or not.

 python runserver 

If you are on a Mac or Linux, use python3 runserver instead of the command given above.  

Once you do that, a URL will be generated on the command line. Now, copy the URL that is generated and paste it on a new tab in your browser.  

That’s it. Everything is set up nicely if you can see this rocket launching up towards the sky.  

Django project in anaconda

Now, your Django environment is set up nicely. After this, you can open Command Prompt or Anaconda Prompt whenever needed, and start doing the project just by activating the environment for Django.  

The following command is used whenever we need to activate the Django environment.

 conda activate djangoenv 

Do these and create stunning projects using your favorite backend web framework “Django”, without changing your Anaconda setup.  

What if Anaconda does not work?

If you have any trouble using the Anaconda software, then there is an alternative option available for you. This software is called Miniconda, which is a lightweight version of Anaconda. 

Miniconda is a software from the Anaconda family itself. they made this light version for people having problems using the big fat Anaconda software. I had a lot of problems using Anaconda at times.

So, I switched to Miniconda software. The only problem is that you will not get the Anaconda user interface in Miniconda. But, if you are comfortable using the command line, you can use this software since it provides the Anaconda prompt. 

It is always better to use this software for your Python projects rather than using your default Python software. You can install Miniconda by going to their website.

Creating Django Projects

Doing projects is the most important thing that you can do to become a better developer. What if you learn the entire syntax of Python and Django and never do a project, then there is no point in your learning.

Django is a difficult framework to learn, especially for absolute beginners. You should get a feel for the framework by doing projects and exercises.

At first, it may seem overwhelming. But after you do some projects, you will figure out a process that can be repeatable. If you can stay motivated and figure out a way to do many projects in Django, you can become a back-end web developer or even a full-stack web developer.

Also, doing a portfolio of amazing projects will increase the chances for you to land your dream job. I recommend you to create a portfolio of projects so that you can display all the work that you have done at a single location.

It is a good practice to upload your code to GitHub or other coding repositories after you finish each project.

If you are interested in creating projects in Django, but you don’t know what to create, then I have a resource for you. I’ve written an article on 12 Django Project Ideas for Beginners, which you can steal right away and implement. Oh, by the way, I’ve added some tutorials along with each idea to help you. Make sure you check it out.

I hope this article would be helpful for you in some way. If you encounter any issues or doubts, please feel free to ask them in the comments section. I will be happy to help you.

Also, share this article with your friends so that it will be helpful to them as well.

Happy coding!

Ashwin Joy

I'm the face behind Pythonista Planet. I learned my first programming language back in 2015. Ever since then, I've been learning programming and immersing myself in technology. On this site, I share everything that I've learned about computer programming.

48 thoughts on “How To Create A Django Project In Anaconda Very Easily

    1. Hi Dharmender,

      If you want to install sqlparse, you can use the following command: conda install -c anaconda sqlparse

      Thank you.

  1. Very helpful. Thanks for sharing these instructions!

    I had some difficulty using the conda activate command.

    If other’s encounter this issue in Windows CMD, try:
    set PATH=%PATH%;\Scripts
    activate djangoenv

    Also if you are using git bash, try:
    source activate djangoenv

  2. Sir, This is a great tutorial for beginners. But here is some issue, when I run the “python runserver” command, it throws an error “can’t open the file [Err No 2] no such file or directory” What to do for this? I looked into the directory, It created the directory by itself but not running.

    1. I think you are not inside the project directory. In the example that I mentioned above, you need to be in the directory called ‘website’ to run this command. So, after you type in django-admin startproject website command, type in cd website. Then type in the python runserver command. Hopefully, this will solve the issue.

  3. Hello, thank you for the tutorial, I really appreciate your hard work. I just need help pls, I found an HTTP error when i tried to create the env ( I typed conda create -n djangoenv python=3.6 anaconda)
    then I found this error:
    CondaHTTPError: HTTP 000 CONNECTION FAILED for url
    Elapsed: –

    An HTTP error occurred when trying to retrieve this URL.
    HTTP errors are often intermittent, and a simple retry will get you on your way.

    CondaHTTPError: HTTP 000 CONNECTION FAILED for url
    Elapsed: –

    An HTTP error occurred when trying to retrieve this URL.
    HTTP errors are often intermittent, and a simple retry will get you on your way.

    CondaHTTPError: HTTP 000 CONNECTION FAILED for url
    Elapsed: –

    An HTTP error occurred when trying to retrieve this URL.
    HTTP errors are often intermittent, and a simple retry will get you on your way.

    CondaHTTPError: HTTP 000 CONNECTION FAILED for url
    Elapsed: –

    An HTTP error occurred when trying to retrieve this URL.
    HTTP errors are often intermittent, and a simple retry will get you on your way.

    1. Just try running the following command: conda config –set ssl_verify no

      and try again to create conda environment. Hopefully it will solve the issue.

  4. Hello is, does spyder support django project? if Yes, kindly tell me the full procedure. thanks for this article which you write about how to install Django with anaconda.

    Muhammad Shams Paracha
    waiting to your response

    1. Yes, you can create Django projects with spyder. In fact, Anaconda navigator has spyder IDE built into it. If you have Anaconda, you can use that. If you’re using python without Anaconda, go to your command line and install Django through pip (pip install django). Then you can install spyder IDE and work with it. Thanks for your comment.

  5. Hi,

    I have a HTML page in my python django application.
    I have a folder named “media” which contains the images that I’m trying to use in my html page, I’m not able to display the images.

    Should I just paste the relative path in the tag or should I do any other setting?
    Could you please help?


    1. 1. Add the following line to the top of your HTML page: {% load static %}
      2. Add an img tag wherever you want to place the image and give the relative path as src.

      For example,

      img src=”{% static ‘../static/code.jpg’ %}” alt=”my_image”

      For me, the HTML file was in the templates folder and my image is in static folder. That’s why I gave a path like that. You can give the correct path according to your file structures.

      If you can’t, just put the image in the folder where your HTML page is, and use the following tag:

      img src=”{% static ‘image.jpg’ %}”

      I hope that helps.

  6. I was able to install Django over Anaconda and even activate the django environment. However when I gave the command Django-admin startproject myproj I get an error saying django-admin is not recognized an internal or external command. I tried to run anaconda django command screen as administrator but still, it did not work. If I need to make changes in the environment variables how do I do it?

    1. Just a correction, the command I gave was correct django-admin startproject myproj – the spelling was correct.

      1. Just type in ‘django’ in your environment and see what comes up. If ‘django’ is not recognized as an internal or external command, operable program or batch file, then try to install it using pip install django command.

        If Django is already there, then uninstall it using pip uninstall django and then install it again using pip install django. I’m not sure whether it’ll fix it or not, but just give it a try. Hopefully, it’ll fix the issue.

          1. hi ashwin i am getting ‘python : can’t open file’’:[error 2 ] no such file or directory .after typing the same command that you gave as” python runserver.
            please help me out ………

          2. I think you’re not inside the correct directory. Go to the correct directory using the cd command and then execute the command.

    1. Maybe you can. I’m not sure though. I’m currently using Miniconda, which does not have the Anaconda navigator GUI.

  7. hi ashwin ,thanks for answering earlier but i am still facing issues , after using python runserver command i got ” starting development server at” but i am not getting welcome page after putting it on use .

    1. Do you use this port(8000) for other purposes? If so, try changing the port:

  8. i was searching the whole internet for this. found ours after 2 hours of trying to install. thank you for this <3

  9. python: can’t open file ‘’: [Errno 2] No such file or directory
    im getting this error i change the path to C:\ProgramData\Anaconda3> but im getting same error

  10. Hi Ashwin,
    Thanks for the tutorial, I find it very useful.
    After python runserver I got the errot below:

    System check identified no issues (0 silenced).
    July 06, 2020 – 22:50:43
    Django version 3.0.3, using settings ‘website.settings’
    Starting development server at
    Quit the server with CTRL-BREAK.
    Error: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

    Any idea where does this problem come from?
    Many thanks.

    1. I don’t have much idea about this error. Seems like an OS error. Please google the error and find out what StackOverflow or other communities are saying about it. Hopefully, you’ll be able to fix it.

      Thank you 🙂

  11. can i use anaconda now in 2020 or its just a old way to create projects using anaconda can u tell me why we use anaconda in django

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Content