Posts
Showing posts from June, 2018
Network interface does not show up with ifconfig and Internet does not work
- Get link
- Other Apps
If for some reasons your ethernet network interface does not show up with ifconfig command, you can do the following to find it and raise it up again:
1. Find the interface:
ifconfig -a
..
enp0s31f6 ... DOWN
...
2. Up the missing interface:
sudo ifconfig enp0s31f6 up
3. Call the DHCP client on the missing interface:
sudo dhclient enp0s31f6
After that, you will be able to access the Internet again.
1. Find the interface:
ifconfig -a
..
enp0s31f6 ... DOWN
...
2. Up the missing interface:
sudo ifconfig enp0s31f6 up
3. Call the DHCP client on the missing interface:
sudo dhclient enp0s31f6
After that, you will be able to access the Internet again.
Django DB migration when you're using a custom MySQL installation dir
- Get link
- Other Apps
For some reason, you installed MySQL in a different path than the default /etc/mysql/. Then if you run the Django's migrate command, it will fail because It cannot communicate with the MySQL process:
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
If that's the case, you can use the following option in your Django's configuration to indicate the socket directory of MySQL:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': '/path/to/my.cnf',
},
}
}
That's it. Profit!!!
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
If that's the case, you can use the following option in your Django's configuration to indicate the socket directory of MySQL:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': '/path/to/my.cnf',
},
}
}
That's it. Profit!!!
Virtualenv's env activated but still running system's python
- Get link
- Other Apps
I created a Virtualenv env and activated it but it still running the system's python
(myenv) dangtrinhnt@genius:~$ which python
/usr/bin/python
So I did the following to fix that:
1. Delete the broken Virtualenv env:
sudo rm -rf /my/venv
2. Create a new one with "distribute" parameter:
virtualenv myenv --distribute
3. It works now
(myenv) dangtrinhnt@genius:~$ which python
/myenv/bin/python
(myenv) dangtrinhnt@genius:~$ which python
/usr/bin/python
So I did the following to fix that:
1. Delete the broken Virtualenv env:
sudo rm -rf /my/venv
2. Create a new one with "distribute" parameter:
virtualenv myenv --distribute
3. It works now
(myenv) dangtrinhnt@genius:~$ which python
/myenv/bin/python
"bower ESUDO Cannot be run with sudo" how to fix
- Get link
- Other Apps
"make requirements" error when trying to install phantomjs
- Get link
- Other Apps
When the `make requirements` command trying to install phantomjs, it shows this error:
...
info lifecycle phantomjs@1.9.20~install: Failed to exec install script
...
verbose stack Error: phantomjs@1.9.20 install: `node install.js`
verbose stack Exit status 1
...
And this solves that problem in my Ubuntu 16.04:
sudo apt install nodejs-legacy
...
info lifecycle phantomjs@1.9.20~install: Failed to exec install script
...
verbose stack Error: phantomjs@1.9.20 install: `node install.js`
verbose stack Exit status 1
...
And this solves that problem in my Ubuntu 16.04:
sudo apt install nodejs-legacy
PIP error after upgraded to v10.0.1
- Get link
- Other Apps
After doing a PIP upgrade:
sudo pip install --upgrade pip
I got this error when running PIP:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
Here is the best way to fix that, clearing the hash in bash:
hash -d pip
or in dash (sh):
hash -r pip
The world is fine now.
sudo pip install --upgrade pip
I got this error when running PIP:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
Here is the best way to fix that, clearing the hash in bash:
hash -d pip
or in dash (sh):
hash -r pip
The world is fine now.
My presentation at OpenStack Summit 2018 in Vancouver
- Get link
- Other Apps
Tacker team at OpenStack Summit 2018 in Vancouver
- Get link
- Other Apps
