Pages

Saturday, March 17, 2018

Fedora 27 : Testing the new Django web framework .

Today I tested the Django web framework version 2.0.3 with python 3 on my Fedora 27 distro.
The main reason is to see if the Django and Fedora working well.
I used the pip to install and activate the virtual environment for python. First you need to create your project into your folder. I make one folder named django_001.
$ mkdir django_001
$ cd django_001
The next step is to create and activate the virtual environment for python language and your project.
$ python3 -m venv django_001_venv
$ source django_001_venv/bin/activate
Into this virtual environment named django_001_venv you will install django web framework.
pip install django
If you have problems with update pip then update this tool. Now start the django project named django_test.
$ django-admin startproject django_test
$ cd django_test
$ python3 manage.py runserver
Open the url http://127.0.0.1:8000/ with your web browser.
The result is this:

If you try to use the admin web with password and user you will see errors.
One of the most common problem for django come from settings, let's see some file from the project:

  • manage.py - this runs project specific tasks (the django-admin is used to execute system wide Django tasks) and is used to execute project specific tasks;
  • __init__.py - this file that allows Python packages to be imported from directories where it's present and it's a generic file used in almost all Python applications;
  • settings.py - the configuration settings for the Django project;
  • urls.py - contains URL patterns for the Django project; 
  • wsgi.py - is WSGI configuration properties for the Django project ( you don't need to setup WSGI to develop Django applications).

The next step is to create first django application.
$ python manage.py startapp django_blog
This make a folder named django_blog into the main django_test folder. Into the main django_test folder you have another django_test folder with settings.py file. Add into settings.py file the django_blog application.
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_blog',
]
Let's fix some issues about admin and the django_blog application.
Into the main django_test folder with manage.py file use this:
$ python3 manage.py migrate
$ python3 manage.py createsuperuser

This fix the django framework and let you to add your superuser using the admin page, see:

The next issue is: create the website ( see the django_blog folder) using the Django web framework.
I don't have a issue for this django_blog but you can follow this tutorial link.

Wednesday, March 14, 2018

Fedora 27 : 'No Space Left on Device' errors .

The No Space Left on Device error is a good issue for a linux user.
The error come one issue that you have no space left on your hard drive.
The purpose of linux user is to detect the problem with the linux operating system.
You can use your root account or sudo user to run some of this linux commands.
This error named No Space Left on Device is just a vague problem and can be the cause of multiple vague errors on Linux systems.
Here are some ways you can solve the problem.

Use du and df commands to see if your disk is full (check into home and root folders area):
# df -h
# df -i /
# du -sh /

Check deleted file reserved by process (PID) with lsof:
# lsof / | grep deleted
Take a look at unlinked files:
# lsof -a +L1 *mountpoint*

Check you have bad filesystem blocks with fsck:
# fsck -vcck /dev/sda2

If you use a virtual machine (VM) then you can get this error in process of emulation of linux operating system for some PID.
It also happened to me with Android Studio software under Fedora 27 - the error is show like: No Space Left on Device.
I do not know why this happens, but I assume it's an emulation task in the memory area.

Monday, March 12, 2018

Fedora and childish ideas .

The marketing, design and promotion of any product is a key element of success.
I have to admit that although I am not an active member of Fedora distribution teams and I am glad to be able to help where it is needed.
Over the last time, I spend my online time with my son playing Roblox ( because he is away from me) and trying to show him what the computer can do for people.
This game allows development with the LUA programming language and object creation for users.
The idea that programs and games are essential factors in our lives.
Also the fact that I have been using Fedora for a long time, I have allowed myself to implement an intention to promote the Fedora distribution.
This is a shirt created with the Fedora logo and can be worn in the Roblox game. He found it here.

Monday, February 26, 2018

Fedora 27 : The LXMusic music player for LXDE.

The LXMusic come with version 0.4.7-4 , update and bugs fixes.
It is a minimalist music player for LXDE with very few features .
This simple XMMS frontend music player named LXMusic has very few features.
I used to playing my list of music files and works great.
The install can be done with dnf tool:
# dnf install lxmusic

Wednesday, February 21, 2018

Fedora 27 : selinux and getfattr attributes.

In this tutorial I show you how to use the getfattr command to get extended attributes of filesystem objects and security selinux.
One attribute is selinux.security for selinux and other like:

  • security.capability - the security.capability files stores Linux capabilities for the related file and is applies to binaries which are provided one or more capabilities via this file.
  • security.ima - for the Integrity Measurement Architecture (IMA), the file security.ima stores a hash or digital signature.
  • security.evm - this is similar to security.ima, the Extended Verification Module (EVM) stores a hash/HMAC or digital signature in this file ( the different with IMA is that it protects the metadata of the file, not the contents).

Now, about selinux.security :
You can use for example the getfattr command to perform specific security selinux tasks:

# getfattr -m security.selinux -d /etc/passwd
getfattr: Removing leading '/' from absolute path
names
# file: etc/passwd 
security.selinux="system_u:object_r:passwd_file_t:s0"
# getfattr -m security.selinux -d /etc/shadow
...
# getfattr -m security.selinux -d /var/www d /var/www
...
Both getfattr and setfattr commands has provided by the POSIX ACL package (Portable Operating Systems Interface).

Thursday, February 15, 2018

Fedora 27 : The strace tool for debug.

Today I test a great tool named strace from here.
This tool will help you with diagnostic, debugging and monitor between processes and the Linux kernel.

For example you can test this tool with ls command:
- to display only a specific system call, use the strace -e option as shown below.
$ strace -e open ls > /dev/null
- the result of this will come with all infos about count time, calls, and errors for each system call.
$ strace -c ls > /dev/null
- save the trace execution to a file:
$ strace -o output.txt ls
- display and save the strace for a given process id:
$ strace -p 1725 -o process_id_trace.txt

You can see more examples on the official webpage.

Tuesday, February 13, 2018

Fedora 27 : Test browsers for inline security.

Open the browser with this page: https://github.com.
Next step is to open the Developer Tools console.
If you use Opera then you can use this keys: Ctr+Shift +C .
If you use Firefox or Chrome browsers use F12 key.
Paste the following code into the console area to create a new inline script and add this java script:
var test = document.createElement('script');
test.innerText = 'alert("hi there");'
document.body.appendChild(test);
For example, this is a good security result on my Opera browser.

The result of this message tell us about the script we tried to execute was stopped by the browser.