<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>wagtail Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/wagtail/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Fri, 19 Jul 2019 00:29:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.13</generator>
	<item>
		<title>How to install Wagtail on Ubuntu 18.04?</title>
		<link>https://www.osradar.com/how-to-install-wagtail-on-ubuntu-18-04/</link>
					<comments>https://www.osradar.com/how-to-install-wagtail-on-ubuntu-18-04/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Sat, 20 Jul 2019 00:33:04 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[bionic]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[gunicorn]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wagtail]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=12521</guid>

					<description><![CDATA[<p>As today almost everything has to do with the Internet and blogs, there are many CMS available. In this post, I will show you how to install Wagtail on Ubuntu 18.04. Of course, I will also tell you about this great CMS new and very well designed. Wagtail is built with Python We have talked [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-wagtail-on-ubuntu-18-04/">How to install Wagtail on Ubuntu 18.04?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>As today almost everything has to do with the Internet and blogs, there are many CMS available. In this post, I will show you how to install Wagtail on Ubuntu 18.04. Of course, I will also tell you about this great CMS new and very well designed.</p>
<h2>Wagtail is built with Python</h2>
<p>We have talked about many <a href="https://www.osradar.com/tag/cms/">CMS</a> on this website. Some with very new features and others simpler and focused on a very specific audience. But Wagtail is something different.</p>
<p><a href="https://wagtail.io/">Wagtail</a> is an open source CMS that is built <strong>with <a href="https://www.osradar.com/install-django-ubuntu-18-04/">Django</a> and therefore in <a href="https://www.osradar.com/get-the-latest-python-on-linux/">Python</a></strong>. This has many advantages in the execution of the application. Above all in issues of performance and clarity of code.</p>
<p>On the other hand, many well-known companies use Wagtail to build some websites, like <a href="https://www.osradar.com/improve-the-firefox-scroll-down/">Mozilla</a> or BMW. So, we are in the presence of a quite powerful CMS.</p>
<p>Some of its main <a href="https://wagtail.io/features/">features</a> focus on fast content <strong>editing using blocks</strong>; likewise, Wagtail has a <strong>form builder</strong> and <strong>integrates <a href="https://www.osradar.com/setting-up-elasticsearch-on-linux/">elasticsearch</a></strong> to do intelligent searches.</p>
<p>Finally, Wagtail wants the user not to waste too much time on configurations. He only spends time perfecting the website. That is to say, it is a CMS out the box. Everything is working for the first time.</p>
<p>So, let us install Wagtail.</p>
<h2>First steps to install Wagtail</h2>
<p>First, we need to update the system so that all the security patches are properly installed.</p>
<p>Open a terminal or connect to your SSH server and run the following:</p>
<pre>:~$ sudo apt update
:~$ sudo apt upgrade</pre>
<p>Then you need to install Python, Python PIP and the tool to create virtual environments with Python. So you have to run this command to do it.</p>
<pre>:~$ sudo apt install python3 python3-pip python3-venv</pre>
<h3>Create a virtual environment for Wagtail</h3>
<p>The next step is to create a virtual Python environment for Wagtail. This way we will be able to isolate the installation and create more security. Besides that, it will facilitate the installation together with PIP. First, install it.</p>
<pre>:~$ sudo pip3 install virtualenv</pre>
<figure id="attachment_12599" aria-describedby="caption-attachment-12599" style="width: 1361px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12599" src="https://www.osradar.com/wp-content/uploads/2019/07/1-4.png" alt="1.- install Python env" width="1361" height="250" srcset="https://www.osradar.com/wp-content/uploads/2019/07/1-4.png 1361w, https://www.osradar.com/wp-content/uploads/2019/07/1-4-300x55.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/1-4-768x141.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/1-4-1024x188.png 1024w, https://www.osradar.com/wp-content/uploads/2019/07/1-4-696x128.png 696w, https://www.osradar.com/wp-content/uploads/2019/07/1-4-1068x196.png 1068w" sizes="(max-width: 1361px) 100vw, 1361px" /><figcaption id="caption-attachment-12599" class="wp-caption-text">1.- install Python env</figcaption></figure>
<p>Then, create a new user. And add it to the sudoers file.</p>
<pre>:~$ sudo useradd -m -s /bin/bash wag
:~$ sudo passwd wag
passwd: password updated successfully
:~$ sudo nano /etc/sudoers
wag ALL=(ALL:ALL) ALL</pre>
<p>Next, create a virtual environment.</p>
<pre>:~$ su - wag
:~$ virtualenv wagtail</pre>
<figure id="attachment_12600" aria-describedby="caption-attachment-12600" style="width: 790px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12600" src="https://www.osradar.com/wp-content/uploads/2019/07/2-4.png" alt="2.- Create the python environment" width="790" height="211" srcset="https://www.osradar.com/wp-content/uploads/2019/07/2-4.png 790w, https://www.osradar.com/wp-content/uploads/2019/07/2-4-300x80.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/2-4-768x205.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/2-4-696x186.png 696w" sizes="(max-width: 790px) 100vw, 790px" /><figcaption id="caption-attachment-12600" class="wp-caption-text">2.- Create a python environment</figcaption></figure>
<p>You can replace &#8220;wagtail&#8221; for any name what you want.</p>
<h3>Install Wagtail</h3>
<p>Now that we have the virtual environment created, we will be able to install Wagtail. However, first, we must activate it.</p>
<pre>:~$ source ~/wagtail/bin/activate</pre>
<p>Now, you can install Wagtail.</p>
<pre>:~$ pip install wagtail</pre>
<figure id="attachment_12601" aria-describedby="caption-attachment-12601" style="width: 444px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12601" src="https://www.osradar.com/wp-content/uploads/2019/07/3-2.png" alt="3.- Install Wagtail on Ubuntu 18.04" width="444" height="61" srcset="https://www.osradar.com/wp-content/uploads/2019/07/3-2.png 444w, https://www.osradar.com/wp-content/uploads/2019/07/3-2-300x41.png 300w" sizes="(max-width: 444px) 100vw, 444px" /><figcaption id="caption-attachment-12601" class="wp-caption-text">3.- Install Wagtail on Ubuntu 18.04</figcaption></figure>
<p>In this case, the command is PIP and not PIP3. This is because, in Python virtual environments, the PIP command does not distinguish from the version used. Therefore, it will always be PIP regardless of the version we have.</p>
<p>Now,  we can create a new project.</p>
<pre>:~$ cd ~
:~$ wagtail start [project_name]</pre>
<figure id="attachment_12602" aria-describedby="caption-attachment-12602" style="width: 783px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12602" src="https://www.osradar.com/wp-content/uploads/2019/07/4.png" alt="4.- Create a new wagtail project" width="783" height="151" srcset="https://www.osradar.com/wp-content/uploads/2019/07/4.png 783w, https://www.osradar.com/wp-content/uploads/2019/07/4-300x58.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/4-768x148.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/4-696x134.png 696w" sizes="(max-width: 783px) 100vw, 783px" /><figcaption id="caption-attachment-12602" class="wp-caption-text">4.- Create a new wagtail project</figcaption></figure>
<p>Then, after the project directory is created. You need to follow these commands to start the new project.</p>
<pre>:~$ cd [project_name]
:~$ python manage.py migrate
:~$ python manage.py createsuperuser
:~$ python manage.py runserver 0.0.0.0:8000</pre>
<p>Now, open your web browser and go to http://server-ip:8000. Remember to open the port on the firewall.</p>
<figure id="attachment_12603" aria-describedby="caption-attachment-12603" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12603" src="https://www.osradar.com/wp-content/uploads/2019/07/5.png" alt="5.- Wagtail running" width="1366" height="666" srcset="https://www.osradar.com/wp-content/uploads/2019/07/5.png 1366w, https://www.osradar.com/wp-content/uploads/2019/07/5-300x146.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/5-768x374.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/5-1024x499.png 1024w, https://www.osradar.com/wp-content/uploads/2019/07/5-533x261.png 533w, https://www.osradar.com/wp-content/uploads/2019/07/5-696x339.png 696w, https://www.osradar.com/wp-content/uploads/2019/07/5-1068x521.png 1068w, https://www.osradar.com/wp-content/uploads/2019/07/5-861x420.png 861w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-12603" class="wp-caption-text">5.- Wagtail running</figcaption></figure>
<p>And you can go to the admin page on http://server-ip:8000/admin. You can log in with the super user previously created.</p>
<figure id="attachment_12604" aria-describedby="caption-attachment-12604" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12604" src="https://www.osradar.com/wp-content/uploads/2019/07/6.png" alt="6.- Wagtail admin" width="1366" height="666" srcset="https://www.osradar.com/wp-content/uploads/2019/07/6.png 1366w, https://www.osradar.com/wp-content/uploads/2019/07/6-300x146.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/6-768x374.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/6-1024x499.png 1024w, https://www.osradar.com/wp-content/uploads/2019/07/6-533x261.png 533w, https://www.osradar.com/wp-content/uploads/2019/07/6-696x339.png 696w, https://www.osradar.com/wp-content/uploads/2019/07/6-1068x521.png 1068w, https://www.osradar.com/wp-content/uploads/2019/07/6-861x420.png 861w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-12604" class="wp-caption-text">6.- Wagtail admin</figcaption></figure>
<h3>Install Gunicorn</h3>
<p>Wagtail is an application built in Django. In that aspect, to deploy it is convenient to use a request manager that runs in Python. But ironically, Python is not the best for processing all requests. In this sense, I will use <a href="https://gunicorn.org/">Gunicorn</a> and link it to the project. Then, I&#8217;ll install <a href="https://www.osradar.com/install-nginx-from-the-source-code-ubuntu-18-04/">Nginx</a>.</p>
<pre>:~$ pip install gunicorn
:~$ cd ~/wagproject
:~$ python manage.py collectstatic
:~$ deactivate
:~$ exit</pre>
<figure id="attachment_12605" aria-describedby="caption-attachment-12605" style="width: 1365px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12605" src="https://www.osradar.com/wp-content/uploads/2019/07/7.png" alt="7.- Getting gunicorn to install Wagtail correctly" width="1365" height="319" srcset="https://www.osradar.com/wp-content/uploads/2019/07/7.png 1365w, https://www.osradar.com/wp-content/uploads/2019/07/7-300x70.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/7-768x179.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/7-1024x239.png 1024w, https://www.osradar.com/wp-content/uploads/2019/07/7-696x163.png 696w, https://www.osradar.com/wp-content/uploads/2019/07/7-1068x250.png 1068w" sizes="(max-width: 1365px) 100vw, 1365px" /><figcaption id="caption-attachment-12605" class="wp-caption-text">7.- Getting gunicorn to install Wagtail correctly</figcaption></figure>
<p>Now, create a new systemd file to manage gunicorn like a service.</p>
<pre>:~$ sudo nano /etc/systemd/system/gunicorn.service</pre>
<p>And add the following:</p>
<pre>[Unit]
Description=Gunicorn Daemon file
After=network.target

[Service]
User=wag
Group=www-data
WorkingDirectory=/home/wag/wagproject
ExecStart=/home/wag/wagtail/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/wag/wagproject.sock wagproject.wsgi:application

[Install]
WantedBy=multi-user.target</pre>
<figure id="attachment_12607" aria-describedby="caption-attachment-12607" style="width: 1365px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12607" src="https://www.osradar.com/wp-content/uploads/2019/07/88888.png" alt="8.- Creating a systemctl service for gunicorn" width="1365" height="263" srcset="https://www.osradar.com/wp-content/uploads/2019/07/88888.png 1365w, https://www.osradar.com/wp-content/uploads/2019/07/88888-300x58.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/88888-768x148.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/88888-1024x197.png 1024w, https://www.osradar.com/wp-content/uploads/2019/07/88888-696x134.png 696w, https://www.osradar.com/wp-content/uploads/2019/07/88888-1068x206.png 1068w" sizes="(max-width: 1365px) 100vw, 1365px" /><figcaption id="caption-attachment-12607" class="wp-caption-text">8.- Creating a systemctl service for gunicorn</figcaption></figure>
<p>Remember, change the user name and the project name so that everything works well.</p>
<p>Press CTRL + O to save the changes and CTRL + X to close the file.</p>
<p>Next, reload all systemd daemon to apply the changes.</p>
<pre>:~$ sudo systemctl daemon-reload</pre>
<p>Then, start gunicorn.</p>
<pre>:~$ sudo systemctl start gunicorn</pre>
<h3>Install Nginx</h3>
<p>As I mentioned earlier, Python is not the best at processing requests. Then, with Nginx, we will be able to improve all that request flow. So let&#8217;s install it</p>
<pre>:~$ sudo apt install nginx</pre>
<p>Now let&#8217;s create a new Nginx server block file.</p>
<pre>:~$ nano /etc/nginx/sites-enabled/your-domain.conf</pre>
<p>Add the following:</p>
<pre>server {
    listen 80;
    server_name your-domain.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/wag/wagproject;
    }

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://unix:/home/wag/wagproject.sock;
    }
}</pre>
<p>Save the changes and close the file.</p>
<p>Then, assign permissions on the project folder and add the new user to the www-data group.</p>
<pre>:~$ sudo usermod -aG www-data wag
:~$ sudo chmod -R 710 /home/wag</pre>
<p>Finally, start and enable Nginx.</p>
<pre>:~$ sudo systemctl enable nginx
:~$ sudo systemctl start nginx</pre>
<p>Now, you can access to Wagtail using your web browser to your domain.</p>
<p>And that is it.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-wagtail-on-ubuntu-18-04/">How to install Wagtail on Ubuntu 18.04?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-wagtail-on-ubuntu-18-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
