2018/09/28

도망가는 효성 vs 뒤쫓는 코오롱…베트남에서 맞붙은 '타이어코드'


화학섬유 업계의 오랜 '맞수'인 효성과 코오롱이 타이어 핵심소재인 타이어코드를 두고 치열한 경쟁을 벌이고 있다. 세계 시장에서 굳건히 1위 자리를 지켜온 효성의 뒤를 코오롱이 바짝 뒤쫓는 형국이다. 두 기업 모두 베트남을 세계 시장 생산거점으로 활용하며 수익성 극대화를 꾀하고 있다는 공통점이 있다. 타이어코드는 타이어가 형태를 갖출 수 있도록 뼈대 역할을 하는 섬유보강재로, 타이어의 내구성을 향상시키고 자동차의 중량을 지탱할 수 있도록 돕는 자동차 핵심 소재다.
세계 2위 도약 꿈꾸는 코오롱…1위 효성 시장점유율 '사수'
코오롱은 지난 18일 베트남 빈증성에 1만6800톤 규모의 타이어코드 생산공장 준공식을 가졌다. 세계시장 점유율 15%로 3위에서 2위 자리로 도약을 꾀하기 위한 승부수다. 이번 증설로 9만3800톤의 생산능력을 확보하게 됐고, 추가 증설이 실행되면 11만3000톤이 된다. 효성의 생산규모는 20만톤 이상으로 추정되는데, 구체적인 숫자는 '대외비'다. 시장점유율이 45%로 워낙 커 납품가가 추정될 수 있다는 것을 우려해서다.
코오롱이 생산 중인 타이어코드는 '페트' 타이어코드인데, 이는 효성의 주력 상품이기도 하다. 효성은 1968년 나일론 타이어코드를 국내 처음으로 생산했고, 코오롱인더스트리도 1973년 타이어코드 사업에 뛰어들었다. 조현준 효성 회장과 이웅열 코오롱 회장은 모두 선대의 사업을 물려 받아 기술개발과 증설을 통해 사업을 키워왔다. 두 회사의 합계 점유율은 60%에 달한다. '전 세계 바퀴의 절반에는 한국산 타이어코드가 들어간다'는 이야기는 나오는 이유다.
두 회사는 고객사도 대부분 겹친다. 타이어 업체들이 물량부족이나 가격 상승에 대비하기 위해 한 회사에서만 제품을 공급받지 않기 때문이다. 국내 타이어 3사(한국·금호·넥센)와 글로벌 타이어 업체(미뤠린·굿이어 등)는 모두 이들과 오랜 관계를 맺어왔다. 
세계 2위 타이어코드 생산업체인 인도라마 벤처스는 유럽업체를 인수하며 몸집을 키우고 있다. 지난해 5월 오스트리아의 글란즈스토프(Glanzstoff)를 인수한데 이어 이달 초 유럽의 코르다나(Kordana)를 인수키로 했다. 전방산업인 자동차와 타이어 시장이 성장하면서 일부 공급과잉 우려에도 장빗빛 전망이 대세다. 시장조사기관 글로벌마켓인사이트는 세계 타이어코드와 페브릭 시장 규모가 2015년 38억5000만 달러에서 2024년까지 64억달러까지 성장할 것으로 예상했다.
베트남에 공들이는 조현준·이웅열 회장
두 회사는 모두 베트남을 세계 시장의 생산 거점으로 삼고 있다. 베트남은 저렴한 인건비와 각종 세제 혜택 등으로 매력적인 투자처로 꼽힌다. 미·중 무역 전쟁으로 인한 위험 요소를 피해갈 수 있기도 하다. 업계 관계자는 "인건비가 싼 데다 정부 차원에서 외국기업이 투자하면 법인세를 지원하는 등 혜택이 있어 베트남은 사업하기 매우 좋은 환경"이라고 말했다. 코트라(KOTRA)에 따르면, 베트남 임금 노동자의 월평균 소득은 541만동(2017년 기준)으로 우리돈으로 환산하면 약 25만8000원이다. 
효성은 지난 2007년부터 호치민 인근 연짝 공단에 법인을 설립하고 현재까지 약 15억 달러를 투자해 스판덱스·타이어코드 등을 생산하고 있다. 지난해부터는 남부 바리아붕따우성에 폴리프로필렌(PP) 공장과 LPG가스 저장탱크 설립을 진행 중이며, 북부 꽝남성에도 추가 생산법인 설립을 검토 중이다. 조현준 회장은 올 2월 응우웬 쑤언 푹 베트남 총리를 직접 만나 베트남 사업 확대를 논의했다. 지난해 기준 효성의 베트남 법인 영업이익은 1734억원으로, 전체 해외법인에서 차지하는 비중이 57%에 달했다.
코오롱인더스트리도 지난 2016~2017년 베트남에 에어백 공장을 준공했고, 호찌민 에어백 봉제공장 인수했다. 타이어코드 베트남 공장은 중국에 이은 두번째 타이어코드 해외 생산기지다. 이웅열 회장은 2016년 투자관련 업무협약(MOU)에서부터 이달 준공식까지 베트남 현지에서 직접 챙길 정도로 공을 들이고 있다.

출처: 뉴스토마토

2018/09/24

Python & Django - Deployment web service(PythonAnywhere)

[Github]

1. download
  - https://desktop.github.com/



2. install Github desktop

3. set clone

4. set ignore files cofigure

5. commit and upload



[PythonAnywhere]

1. Login or register

2. open Bash console

06:03 ~ $ 06:03 ~ $ pwd/home/redrain06:03 ~ $ python --versionPython 2.7.1206:03 ~ $ python3 --versionPython 3.7.006:03 ~ $


3. Upload Git setting
- copy git address


- set address in PythonAnywhere

06:08 ~ $ git clone https://github.com/RedRainKim/DevBlog.gitCloning into 'DevBlog'...remote: Counting objects: 31, done.remote: Compressing objects: 100% (26/26), done.remote: Total 31 (delta 1), reused 31 (delta 1), pack-reused 0Unpacking objects: 100% (31/31), done.Checking connectivity... done.06:08 ~ $



4. update (change source code)

06:11 ~/DevBlog (master)$ git pullAlready up-to-date.06:11 ~/DevBlog (master)$


5. tree
06:11 ~/DevBlog (master)$ tree.├── blog│   ├── __init__.py│   ├── admin.py│   ├── apps.py│   ├── forms.py│   ├── migrations│   │   ├── 0001_initial.py│   │   └── __init__.py│   ├── models.py│   ├── static│   │   └── css│   │   └── blog.css│   ├── templates│   │   └── blog│   │   ├── base.html│   │   ├── post_detail.html│   │   ├── post_edit.html│   │   └── post_list.html│   ├── tests.py│   ├── urls.py│   └── views.py├── manage.py└── mysite ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py7 directories, 20 files06:12 ~/DevBlog (master)$


6. virtual environment
06:17 ~/DevBlog (master)$ python3 --versionPython 3.7.0 06:18 ~/DevBlog (master)$ virtualenv --python=python3.6 myvenv Running virtualenv with interpreter /usr/bin/python3.6 Using base prefix '/usr' New python executable in /home/redrain/DevBlog/myvenv/bin/python3.6 Also creating executable in /home/redrain/DevBlog/myvenv/bin/python Installing setuptools, pip, wheel...done. 06:19 ~/DevBlog (master)$ 06:19 ~/DevBlog (master)$ 06:19 ~/DevBlog (master)$ source myvenv/bin/activate(myvenv) 06:19 ~/DevBlog (master)$ (myvenv) 06:19 ~/DevBlog (master)$ (myvenv) 06:19 ~/DevBlog (master)$


7. install Django
(myvenv) 06:19 ~/DevBlog (master)$ pip --versionpip 18.0 from /home/redrain/DevBlog/myvenv/lib/python3.6/site-packages/pip (python 3.6) (myvenv) 06:20 ~/DevBlog (master)$ pip install django Looking in links: /usr/share/pip-wheels Collecting django Downloading https://files.pythonhosted.org/packages/ca/7e/fc068d164b32552ae3a8f8d5d0280c083f2e8d553e71ecacc21927564561/Django-2.1.1-py3-none-any.whl (7.3MB) 100% |████████████████████████████████| 7.3MB 553kB/s Collecting pytz (from django) Installing collected packages: pytz, django Successfully installed django-2.1.1 pytz-2018.5 (myvenv) 06:23 ~/DevBlog (master)$



8. Create database
(myvenv) 06:25 ~/DevBlog (master)$ python --version Python 3.6.6 (myvenv) 06:25 ~/DevBlog (master)$ (myvenv) 06:25 ~/DevBlog (master)$ (myvenv) 06:25 ~/DevBlog (master)$ python manage.py migrate Operations to perform: Apply all migrations: admin, auth, blog, contenttypes, sessions Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0002_alter_permission_name_max_length... OK Applying auth.0003_alter_user_email_max_length... OK Applying auth.0004_alter_user_username_opts... OK Applying auth.0005_alter_user_last_login_null... OK Applying auth.0006_require_contenttypes_0002... OK Applying auth.0007_alter_validators_add_error_messages... OK Applying auth.0008_alter_user_username_max_length... OK Applying auth.0009_alter_user_last_name_max_length... OK Applying blog.0001_initial... OK Applying sessions.0001_initial... OK (myvenv) 06:25 ~/DevBlog (master)$ (myvenv) 06:26 ~/DevBlog (master)$ python manage.py createsuperuserUsername (leave blank to use 'redrain'): redrain Email address: kim.redrain@gmail.com Password: Password (again): Superuser created successfully.(myvenv) 06:27 ~/DevBlog (master)$


9. collect static files
(myvenv) 06:29 ~/DevBlog (master)$ python manage.py collectstatic120 static files copied to '/home/redrain/DevBlog/static'.(myvenv) 06:30 ~/DevBlog (master)$ s -lbash: s: command not found(myvenv) 06:30 ~/DevBlog (master)$ ls -ltotal 72drwxrwxr-x 6 redrain registered_users 4096 Sep 24 06:25 blog-rw-r--r-- 1 redrain registered_users 46080 Sep 24 06:27 db.sqlite3-rw-rw-r-- 1 redrain registered_users 538 Sep 24 06:08 manage.pydrwxrwxr-x 3 redrain registered_users 4096 Sep 24 06:25 mysitedrwxrwxr-x 5 redrain registered_users 4096 Sep 24 06:18 myvenvdrwxrwxr-x 4 redrain registered_users 4096 Sep 24 06:30 static(myvenv) 06:30 ~/DevBlog (master)$



10. make web




11. configure
 - virtual environment set


- WSGI file setting


- reload
  * when update source code (.py files) should be reload every time


Python & Django - Djangogirls tutorial

Djangogirls tutorial

[Set server]

1. check installed Django version

  >> (myvenv)$ django-admin --version 


2. Create project

  >> (myvenv)$ django-admin startproject mysite .


3. Modify settings.py for mysite

DEBUG = True

ALLOWED_HOSTS = ['*']



LANGUAGE_CODE = 'en-us'

#TIME_ZONE = 'UTC'
TIME_ZONE = 'Asia/Saigon'




STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')



4. Migrate
  - (myvenv)$ python manage.py migrate


5. Run Server
  - (myvenv) D:\DevWeb\djangogirls>python manage.py runserver
    Performing system checks...

    System check identified no issues (0 silenced).
    May 08, 2018 - 13:38:56
    Django version 1.11.13, using settings 'mysite.settings'
    Starting development server at http://127.0.0.1:8000/
    Quit the server with CTRL-BREAK.





[Models - tables]

1. Create App
  - (myvenv) $ python manage.py startapp blog

  - setting.py --> add installed apps

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog',
]


2. define Post class (Database table)

from django.db import models
from django.utils import timezone

# Create your models here.

class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
Created_date = models.DateTimeField(default=timezone.now)
published_date = models.DateTimeField(blank=True, null=True)

def publish(self):
self.published_date = timezone.now()
self.save()

def __str__(self):
return self.title


3. Migrate for app

(myvenv) $ python manage.py makemigrations blog
Migrations for 'blog':
  blog\migrations\0001_initial.py
    - Create model Post

(myvenv) $ python manage.py migrate blog
Operations to perform:
  Apply all migrations: blog
Running migrations:
  Applying blog.0001_initial... OK


(myvenv) $




[Use admin mode]

1. connect admin
  - http://localhost/admin/


2. create super user
(myvenv) $ python manage.py createsuperuser
Username (leave blank to use 'administrator'): admin
Email address:
Password:
Password (again):
This password is too short. It must contain at least 8 characters.
This password is too common.
Password:
Password (again):
Superuser created successfully.


3. define for use new post object in admin mode
  - open blog --> admin.py 
  - register
from django.contrib import admin
from .models import Post

admin.site.register(Post)




[URL mapping]

1. mysite --> urls.py


from django.conf.urls import url
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'', include('blog.urls')),
]


django 2.1.1
from django.contrib import admin
from django.urls import path
from django.urls import include

urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls')),
]



2. blog --> urls.py

from django.conf.urls import url
from . import views

urlpatterns = [
url(r'^$', views.post_list, name='post_list'),
]

django 2.1.1

from django.urls import path
from . import views

urlpatterns = [
path('', views.post_list, name='post_list'),
]



3. blog --> views.py

from django.shortcuts import render

def post_list(request):
pass

django 2.1.1
from django.shortcuts import render

# Create your views here.
def post_list(request):
pass






[Views]

1. define views.py

# Create your views here.
def post_list(request):
return render(request, 'blog/post_list.html', {})


2. create blog/post_list.html file
  - location at new folder --> templates\blog\post_list.html
  - after restart django server for recognize new folder


3. Query set
  - Django shell : 기본적으로 일반 python shell에서는 Django의 데이터를 참조 할 수 없다.
  - $ python manage.py shell 


>>> from blog.models import Post
>>> Post.objects.all()
<QuerySet [<Post: Test message 001>, <Post: Kim Jong-un believes North Korea sho
uld follow Vietnam’s economic reforms: report>, <Post: Vietnam facing China’s
renewed assertiveness in South China Sea>]>
>>> for post in Post.objects.all():
...     print(post)
...
Test message 001
Kim Jong-un believes North Korea should follow Vietnam’s economic reforms: report
Vietnam facing China’s renewed assertiveness in South China Sea

>>>


4. Query Set = Post.objects.all()
>>> qs = Post.objects.all()
>>> print(qs)
<QuerySet [<Post: Test message 001>, <Post: Kim Jong-un believes North Korea sho
uld follow Vietnam’s economic reforms: report>, <Post: Vietnam facing China’s
renewed assertiveness in South China Sea>]>
>>> type(qs)
<class 'django.db.models.query.QuerySet'>


** optional : install ipython (pip install ipython)


5. Create Query Set
  - Post.objects.create(author=me, title='Sample title', text='Test')
    * author.....

 - import User model
In [10]: from django.contrib.auth.models import User

In [11]: User.objects.all()
Out[11]: <QuerySet [<User: admin>]>

In [12]: me = User.objects.first()

In [13]: me.username
Out[13]: 'admin'

In [14]: me.password
Out[14]: 'pbkdf2_sha256$36000$hUPtE7MD2AIv$QBA7Jba0qVaB81gZ3eTqbJXtgouSwQ+rETn8
CGMzQs='

In [15]: Post
Out[15]: blog.models.Post

In [16]: Post.objects.create(author=me, title='Sample Title', text='Test')
Out[16]: <Post: Sample Title>


6. Filtering
  - Post.objects.filter(author=me)
  - Post.objects.filter(title__contains='title')
  - Post.objects.filter(published_date__lte(gte)=timezone.now())


7. Order
  - Post.objects.order_by('create_date')
  - Post.objects.order_by('-create_date')

8. can combine filter and order and filter again and order again...





[Template Dynamic Data]
1. views.py
from django.shortcuts import render
from django.utils import timezone
from .models import Post


def post_list(request):
# set Query set
qs = Post.objects.all()
qs = qs.filter(published_date__lte=timezone.now())
qs = qs.order_by('published_date')

return render(request, 'blog/post_list.html', {
'post_list':qs,
})

2. post_list.html

<html>
<head>
<title>Django Girls blog</title>
</head>
<body>
<div>
<h1><a href="/">Django Girls Blog</a></h1>
</div>

<hr />

{% for post in post_list %}
<div>
<p>published: {{ post.published_date }}</p>
<h1><a href="">{{ post.title }}</a></h1>
<p>{{ post.text|linebreaksbr }}</p>
</div>
{% endfor %}

</body>
</html>



[CSS]

1. bootstrap

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">

2. Static files
  - create static folder in blog project folder

djangogirls
├── blog
│   ├── migrations
│   ├── static
│   └── templates
└── mysite
3. blog.css

h2 a {
color: #FCA205;
}


{% load staticfiles %}

<link rel="stylesheet" href="<% static "blog/blog.css" %}" >


4. font

<link href="//fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext" rel="stylesheet" type="text/css">
As before, check the order and place before the link to blog/static/css/blog.css. This line will import a font called Lobster from Google Fonts (https://www.google.com/fonts).

Find the h1 a declaration block (the code between braces { and }) in the CSS file blog/static/css/blog.css. Now add the line font-family: 'Lobster'; between the braces, and refresh the page:
h1 a {
    color: #FCA205;
    font-family: 'Lobster';
}
5. use Class

6. study CSS --> Codeacademy HTML & CSS course




[Template overload]


1. base.html 
  - define block "block_name"

{% block contents %}
{% endblock %}


2. post_list.html
  -  define block item
{% extends 'blog/base.html' %}

{% block contents %}
{% for post in post_list %}
<div class="post">
<div class="date">
<p>published: {{ post.published_date }}</p>
</div>
<h2><a href=""> {{ post.title }} </a></h2>
<p>{{ post.text|linebreaks }} </p>
</div>
{% endfor %}
{% endblock %}





[Application extend]

1. Add define URL for post_detail
  -- django 2.0 --> update path()


urlpatterns = [
path('', views.post_list, name='post_list'),
#url(r'^post/(?P<pk> \d+)/$', views.post_detail, name='post_detail'),
path('post/<int:pk>/', views.post_detail, name='post_detail'),
]


2. Create post_detail function in veiws class(views.py)

def post_detail(request, pk):
post = get_object_or_404(Post, pk=pk)
return render(request, 'blog/post_detail.html', {
'post': post,
})


3. Define link direction
  --> in post_list.html

<h2><a href="{% url 'post_detail' pk=post.pk %}"> {{ post.title }} </a></h2>


4. Create post_detail.html file 

{% extends 'blog/base.html' %}

{% block contents %}
<div class="post">
{% if post.published_date %}
<div class="date">
{{ post.published_date }}
</div>
{% endif %}
<h1>{{ post.title }}</h1>
<p>{{ post.text|linebreaksbr }}</p>
</div>
{% endblock %}




[Django Form]

1. Create froms.py


from django import forms
from blog.models import Post

class Postform(forms.ModelForm):
class Meta:
model = Post
fields = ['title', 'text']


2. make link button in base.html


<a href="{% url 'post_new' %}" class="top-menu">
<span class="glyphicon glyphicon-plus"></span>
</a>


3. Add url


path('post/new/', views.post_new, name='post_new'),


4. Add simple funcion post_new in views.py 


from blog.forms import Postform

def post_new(request):
form = Postform()
return render(request, 'blog/post_edit.html', {
'form' : form,
})


5. Make post_edit.html


{% extends 'blog/base.html' %}

{% block contents %}
<h1>New Post</h1>
<form method="POST" class="post-form">{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="save btn btn-primary">save</button>
</form>
{% endblock %}


6. Modify post_new function for save feature in views.py


def post_new(request):
# request.POST, request.FILES
if request.method == "POST" :
form = Postform(request.POST, request.FILES)

if form.is_valid():
post = form.save(commit=False)
post.author = request.user
post.published_date = timezone.now()
post.save()
return redirect('post_detail', pk=post.pk)
else:
form = Postform()

return render(request, 'blog/post_edit.html', {
'form' : form,
})



[Application extend - modify]
1. Create post_edit function in views.py



def post_edit(request, pk):
post = get_object_or_404(Post, pk=pk)
if request.method == "POST":
form = Postform(request.POST, request.FILES, instance=post)

if form.is_valid():
post = form.save(commit=False)
post.author = request.user
post.published_date = timezone.now()
post.save()
return redirect('post_detail', pk=post.pk)
else:
form = Postform(instance=post)

return render(request, 'blog/post_edit.html', {
'form': form,
})


2. Add button in post_detail.html



<a class="btn btn-default" href="{% url 'post_edit' pk=post.pk %}">



3. Add url


path('post/<int:pk>/edit/', views.post_edit, name='post_edit'),


4. Auth


{% if user.is_authenticated %}
<a href="{% url 'post_new' %}" class="top-menu">
<span class="glyphicon glyphicon-plus"></span>
</a>
{% endif %}



지멘스 PLC 통신 프로그래밍

지멘스 PLC 통신 프로그래밍 현재 SIEMENS S7-300 PLC 계열 장비를 사용중입니다. 얼마전 간단히 PLC Value 몇개를 주기적으로 모니터링 해야 하는 경우가 생겼습니다. C#을 주로 사용하고 있어서 C#으로 SIEMENS PLC와...