How to configure the Django environment and keep the settings?

1

Hello, I'm starting to learn Django and well part of the material teaches to do the setting of Environment with Virtualenv. But I'm having a lot of trouble configuring the System.

First, I use a Macbook Pro with Sierra OSX. Second, I have already made the necessary installations, the Homebrew, PIP, virtualenv. But the virtualenv commands do not work. I've tried a LOT of internet solutions, changing the PATH of the files and etc, a number of things even. One of those times for some reason worked out, but there were so many things I did that I do not know exactly what made it work. But when I closed the terminal and opened it again everything had stopped working.

I do not know what I do, I do not know how I can configure it. My friend who also owns a computer with the same settings as mine Got to have the environment running normally, nothing was needed other than file installations and everything. I would like to know what I can do, because I even formatted my Mac to do the environment configuration and it still presents problems when executing any command of the installed dependencies.

I am quite frustrated and irritated by the situation, if you can help me, thank you very much.

Well, I started with these:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew install python3

sudo -H easy_install pip

sudo -H pip install virtualenv

sudo -H pip install virutalenvwrapper

The attempted Virtualenv commands were: mkvirtualenv teste Which returned in response: -bash: mkvirtualenv: command not found

    
asked by anonymous 18.05.2017 / 05:31

2 answers

0

I'll give you the steps I've taken here:

  • Check if virtualenv is working.

    > virtualenv env
    

    Here you have created a env directory as expected.

  • Installing Django

    > pip install Django
    
  • Check if you've set configuration for virtualenvwrapper on profile (% with%)

    The ~/.bashrc file of your .bashrc directory should have the following lines:

    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh
    
  • Reload your settings

    In bash, run:

    > source ~/.bashrc
    

    And then try again:

    > mkvirtualenv teste
    
  • 18.05.2017 / 06:31
    0

    Consider "throwing away" the virtual env, seriously! The solution? Anaconda . To install you have two options:

    Graphical Installer

    • Download the graphical installer
    • Double-click the .dpkg file and follow the instructions

    Command line installation

    bash Anaconda3-4.3.1-MacOSX-x86_64.sh  (python 3.6)
    bash Anaconda2-4.3.1-MacOSX-x86_64.sh  (python 2.7)
    

    Creating a new env

    conda create -n nome_da_env python=2.7  # Env com o python 2
    conda create -n py36 python=3.6         # Env com o python 3 
    

    Considerations:

    • Anaconda has problems with virtual-env, uninstall it

    • This package solves the problem on ISPs where you do not have access to root, such as Dreamhost, once it installs python versions, regardless of the system. As the anacoda comes as 'terracotta' packages, mainly in the scientific area, some people say that it is heavy and that in some cases it is a chanhão to kill a mosquito, but this is ignorance, for that we have the miniconda.

    • Anaconda is a distribution and conda is an ambinte / package manager.

    Conda: Myths and Misconceptions

    Finally, I find it interesting to take a look at .

    Download Anaconda .

        
    18.05.2017 / 17:12