Virtualenv "workon" command online working in one terminal tab. - django

I'm working on a django project.
I hav virtualenv and virtualenvwrapper setup. When I invoke
workon myprojectname
I cannot invoke it again in another terminal tab or window. Any ideas why?
Does it have anything to do with postactivate hooks? I wouldn't think so.
Thanks for the help.

Have you added the virtualenvwrapper commands to your startup shell file?
For Example, if you're using Terminal on Mac, add the following lines to your ~/.bash_profile:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
http://virtualenvwrapper.readthedocs.org/en/latest/install.html#shell-startup-file

Related

Can't add WSL Node Interpreter to WebStorm

I need to add WSL node interpreter to WebStorm (2020.1) but Linux distribution is not detected by WebStorm, even though I have Alpine WSL install through Windows Store.
I read this question, but no help. Also manually adding entry in wsl.distributions.xml didn't work, did a lot of research but nothing worked.
I was able to use WSL as terminal in WebStorm by adding wsl.exe location to shell path. My objective is to run npm scripts form from Run/Debug configuration.
I solved by reinstalling WebStorm and copying options folder
from C:\Users\me\AppData\Roaming\JetBrains\WebStorm2020.1
to C:\Users\me\AppData\Local\JetBrains\WebStorm2020.1, then WebStorm could detect Linux distribution installed on machine.
But, now when I am trying to run scripts from NPM Tool Window of WebStorm, WebStorm runs C:\Windows\System32\wsl.exe run "/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run start --scripts-prepend-node-path=auto" where run is redundant coming after C:\Windows\System32\wsl.exe ...
How can I set WebStorm to not have run in wsl.exe run ...?

Command not found for start new project

I am starting out with Django on my Mac, I installed Django2 and installed PyCharm
But when I try to run command from terminal to create a new project on desktop:
django-admin.py startproject name or
django-admin startproject name
then I get "command not found"
Pycharm shows my env at /Users/admin/PycharmProjects/untitled/venv
Please help
Thank you
I am not familiar with the environment on the Mac, but i think the setup are almost the same. It seems that you have not activated your environment.
I use the virtual env on an ubuntu and i have to activate the environmet before i can start creating projects and apps. I hope that helps.
https://www.jetbrains.com/help/pycharm-edu/creating-virtual-environment.html
I think this may help. You can specify your python environment in pycharm.

can't add flasfka package path in Mac

I need to use Kafka with flask-socketIO for a project. So I decided to use flasfka app that does push/pull to Kafka through http.
Following the instruction, I added FLASFKA_CONFIG path in environment
export FLASFKA_CONFIG=/etc/flasfka.conf.py
But when I run flasfka-serve to start flasfka, I get error
flasfka-serve: command not found
I even added the above export command in my .bash_profile file and restarted the terminal but I am still getting the error.
Looks like the documentation is WRONG.
It says
pip install kafka
instead it should be
pip install flasfka

is it possible to access already running virtualenv in windows

is it possible to access already running virtualenv in windows by external tools ? I need this to run cron like tasks by executing python manage.py dosometing of running instance of django. For this I thought I would setup windows task that will execute something like cmd.exe C:\django\manage.py dosometing but I dont understand how to do this if django is running inside virtualenv
Yes you can. The virtualenv is not like a virtual machine, it is not running. The virtualenv is a just a setup where you can have multiple python installations on a single machine. Each virtualenv lives in a separate directory so you can have different libraries installed, different versions of python etc. When you 'activate' the virtualenv you are just setting environment variables such as PATH which tell python programs which python executables and libraries to use.
So when people say 'Django is running in virtualenv' they just mean django is running.. and there's a virtualenv set up that is controlling which python installation Django is using.
If you look at the virtualenv documentation here: https://virtualenv.pypa.io/en/stable/userguide/ ...
It tells you that your activation script is located at:
\path\to\env\Scripts\activate
Where \path\to\env should be replaced by the actual location of your virtualenv.
So, if you are running in a command window, run the activation script first, then all your following commands will be in the virtualenv. If you're running from the scheduler etc, the easiest thing for you to do is, create a batch file which first runs the activation script, then your django command. This ensures that you'll always run in the correct virtualenv.
If you really only have one python installation, then technically the virtualenv isn't necessary.. and in that case you could edit your Windows environment variables as follows:
VIRTUAL_ENV="/path/to/your/virtualenv"
And then also, append to the end of your Path variable the path to your python and python scripts directories. On my system these are:
C:\Python27\Scripts;C:\python27\;
..and make sure there are no other python directories in your path.
If you open a powershell window and run env, it will show you the current settings of your environment variables. If you do this, run activate (in your virtualenv directory) and then run env again, comparing the Path (and other variables) between the two.. then you'll easily be able to see what activate did to your environment, and you can then add that to your Windows configuration.
Then when you run python myprogram.py it'll be using the virtualenv without activation.

How does one start programming with Clojure in Windows?

I know it is possible to use CounterClockwise inside Eclipse, but I have been trying to get Leiningen to work so that I could use ClojureScript.
I downloaded leiningen using git clone. It then says run the script. I have tried lein self-install from inside PowerShell and inside the git bash environment.
In each I get an error about failing to download leiningen (which I thought I had with the git clone? hmm). It is interesting because one reads instructions that include things that don't make sense to Windows.
For example, inside Powershell, Windows doesn't understand export HTTP_CLIENT. It was only inside the git bash that I got a message that it is possible my HTTP client's certificate store does not have the correct certificate authority.
It then suggests this command, which runs ok, export HTTP_CLIENT="curl --insecure -f -L -o"
but it doesn't fix the problem.
The most recommended method AFAIK is to download the script lein.bat and putting it on the PATH environment variable. I've tested this method on several systems (XP, Windows 7). There is no need to build leiningen from a git checkout yourself. If you have a Windows with Powershell installed lein self-install should download the core .jar file inside a directory .lein in your user directory. Else, make sure you install either wget.exe or curl.exe and put it on the PATH.
There is an installer for Leiningen on Windows. You just need to install Java SE 7 JDK and Leiningen for Windows. This page has detailed instructions with screen shots: http://leiningen-win-installer.djpowell.net/
Leiningen for Windows creates a PATH variable and Clojure REPL shortcut among other things. From the REPL you can create, build, and automate your Clojure project.